From: Magnus Hagander Date: Sat, 25 May 2013 18:16:07 +0000 (-0400) Subject: Switch to using staticfiles app for serving, well, static files X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=2ea607b942da86b9c330d536bcf3de01988856f7;p=pgweb.git Switch to using staticfiles app for serving, well, static files This is required by the new admin interface --- diff --git a/pgweb/settings.py b/pgweb/settings.py index 27cdb662..101fc336 100644 --- a/pgweb/settings.py +++ b/pgweb/settings.py @@ -41,11 +41,11 @@ MEDIA_ROOT = '' # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '' +STATIC_URL = '/media/' -# 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 = '/adminmedia/' +STATICFILES_DIRS = ( + '../media/', +) # Make this unique, and don't share it with anybody. SECRET_KEY = 'REALLYCHANGETHISINSETTINGS_LOCAL.PY' @@ -94,6 +94,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.markup', + 'django.contrib.staticfiles', 'pgweb.core', 'pgweb.account', 'pgweb.news', diff --git a/pgweb/urls.py b/pgweb/urls.py index 0f794662..7773849d 100644 --- a/pgweb/urls.py +++ b/pgweb/urls.py @@ -135,9 +135,6 @@ urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), # This should not happen in production - serve by the webserver natively! - url(r'^media/(.*)$', 'django.views.static.serve', { - 'document_root': '../media', - }), url(r'^(favicon.ico)$', 'django.views.static.serve', { 'document_root': '../media', }),