Switch to using staticfiles app for serving, well, static files
authorMagnus Hagander <magnus@hagander.net>
Sat, 25 May 2013 18:16:07 +0000 (14:16 -0400)
committerMagnus Hagander <magnus@hagander.net>
Sun, 16 Jun 2013 14:35:21 +0000 (16:35 +0200)
This is required by the new admin interface

pgweb/settings.py
pgweb/urls.py

index 27cdb662c5b6dae8136b5a446ef3b4e54692f2bc..101fc336699930cf586bf8374be0f8d6e6a971e4 100644 (file)
@@ -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',
index 0f79466266ca8d116f05aae81bf9f032290658a4..7773849dd2746cb3a7fde5c69dc8745e54335457 100644 (file)
@@ -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',
     }),