Skip to content

Commit

Permalink
Merge pull request #88 from HCDigitalScholarship/media
Browse files Browse the repository at this point in the history
Serve media files from /media
  • Loading branch information
alexgleason authored Sep 15, 2023
2 parents 7313a5e + b60b643 commit bcbb6c8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ settings_secret.py
*.swp
lib
__pycache__
/media
/data
6 changes: 4 additions & 2 deletions QI/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = "/static/"

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = "/media/"

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
Expand Down
3 changes: 3 additions & 0 deletions QI/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf import settings
from django.conf.urls import *
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required

Expand Down Expand Up @@ -68,6 +70,7 @@
re_path(r'^manuscripts/(?P<id>\S+).pdf/',views.pdf, name="pdf")
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

admin.site.site_header = 'Beyond Penns Treaty'
admin.site.index_title = 'Beyond Penns Treaty Administration'
Expand Down
5 changes: 5 additions & 0 deletions installation/dokku/media.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Serve media files through Nginx on the host machine.

location /images/ {
alias /var/lib/dokku/data/storage/pennstreaty/media/;
}
2 changes: 1 addition & 1 deletion templates/viewpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ <h3 id="name" style="text-align:center;"> {{manuscript.title}} </h3>

<div style="overflow:scroll; margin-top:auto;">

<img id="image" src="/static/img/{{current_page.id_tei}}.jpg" width"100%" style="overflow:scroll" >
<img id="image" src="/media/img/{{current_page.id_tei}}.jpg" width"100%" style="overflow:scroll" >
<!--<div id="seadragon-viewer" style="width:100%; height:100%"></div>-->
</div>
</div>
Expand Down

0 comments on commit bcbb6c8

Please sign in to comment.