always serve static files, if behind nginx/apache those are not handed down

This commit is contained in:
j 2011-11-03 13:02:12 +01:00
parent af2c26a36a
commit 0ed8c805c7
2 changed files with 8 additions and 10 deletions

View File

@ -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).

View File

@ -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<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
(r'^tests/(?P<path>.*)$', '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<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
)
urlpatterns += patterns('',
(r'^(V[a-z0-9]*)$', 'urlalias.views.padma_video'),