From 0ed8c805c72d786f3ccc7a1fd13b80871810ca9b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 3 Nov 2011 13:02:12 +0100 Subject: [PATCH] always serve static files, if behind nginx/apache those are not handed down --- pandora/settings.py | 1 - pandora/urls.py | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pandora/settings.py b/pandora/settings.py index b90840544..a9703ead1 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -42,7 +42,6 @@ APPEND_SLASH = False # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = normpath(join(PROJECT_ROOT, '..', 'data')) STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static')) -TESTS_ROOT = join(PROJECT_ROOT, 'tests') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). diff --git a/pandora/urls.py b/pandora/urls.py index cd2105895..6bb4da04a 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -30,15 +30,14 @@ urlpatterns = patterns('', (r'^robots.txt$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'robots.txt'), 'content_type': 'text/plain'}), (r'^favicon.ico$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'png/icon.16.png'), 'content_type': 'image/x-icon'}), ) -if settings.DEBUG: - urlpatterns += patterns('', - (r'^data/(?P.*)$', 'django.views.static.serve', - {'document_root': settings.MEDIA_ROOT}), - (r'^static/(?P.*)$', 'django.views.static.serve', - {'document_root': settings.STATIC_ROOT}), - (r'^tests/(?P.*)$', 'django.views.static.serve', - {'document_root': settings.TESTS_ROOT}), - ) +#if settings.DEBUG: +#sould this not be enabled by default? nginx should handle those +urlpatterns += patterns('', + (r'^data/(?P.*)$', 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT}), + (r'^static/(?P.*)$', 'django.views.static.serve', + {'document_root': settings.STATIC_ROOT}), +) urlpatterns += patterns('', (r'^(V[a-z0-9]*)$', 'urlalias.views.padma_video'),