Skip to content

Commit

Permalink
Fix serving of django-admin static assets
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w committed May 22, 2019
1 parent 2095277 commit d3e34cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cloud_browser_project/settings.py
Expand Up @@ -50,7 +50,7 @@
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
STATIC_URL = '/static/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '(4bum1ge3nl_dm(&+3e!4^xozw3yl3m=ik#!-@)vp=#oxn@))y'
Expand Down
8 changes: 8 additions & 0 deletions cloud_browser_project/urls.py
@@ -1,4 +1,5 @@
# pylint: disable=no-value-for-parameter
import os

from django.conf import settings
from django.conf.urls import url, include
Expand Down Expand Up @@ -40,3 +41,10 @@
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
]
# Serve up static admin media.
urlpatterns += [
url(r'^' + settings.STATIC_URL.strip('/') + '/admin/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': os.path.join(os.path.dirname(admin.__file__),
'static', 'admin')}),
]

0 comments on commit d3e34cc

Please sign in to comment.