|
1 | 1 | # Copyright The IETF Trust 2007, 2009, All Rights Reserved |
2 | 2 |
|
| 3 | +from django.conf import settings |
3 | 4 | from django.conf.urls import patterns, include |
4 | 5 | from django.contrib import admin |
5 | 6 | from django.views.generic import TemplateView |
| 7 | +from django.contrib.staticfiles.urls import staticfiles_urlpatterns |
6 | 8 |
|
7 | 9 | from ietf.liaisons.sitemaps import LiaisonMap |
8 | 10 | from ietf.ipr.sitemaps import IPRMap |
9 | 11 | from ietf import api |
10 | 12 |
|
11 | | -from django.conf import settings |
12 | | - |
13 | 13 | admin.autodiscover() |
14 | 14 | api.autodiscover() |
15 | 15 |
|
|
72 | 72 | (r'^api/v1/', include(a.urls)), |
73 | 73 | ) |
74 | 74 |
|
75 | | -# This is needed to serve files which are not handled by collectstatic: |
| 75 | +# This is needed to serve files during testing |
76 | 76 | if settings.SERVER_MODE in ('development', 'test'): |
77 | | - urlpatterns += patterns('', |
78 | | - (r'^(?P<path>(?:images|css|js|test|static)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}), |
79 | | - (r'^(?P<path>admin/(?:img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}), |
80 | | - (r'^(?P<path>secretariat/(img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}), |
81 | | - (r'^(?P<path>robots\.txt)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL+"dev/"}), |
82 | | - (r'^_test500/$', lambda x: None), |
83 | | - (r'^environment/$', 'ietf.help.views.environment'), |
84 | | - ) |
| 77 | + urlpatterns += ( staticfiles_urlpatterns() |
| 78 | + + patterns('', |
| 79 | + (r'^_test500/$', lambda x: None), |
| 80 | + (r'^environment/$', 'ietf.help.views.environment'), |
| 81 | + ## maybe preserve some static legacy URLs ? |
| 82 | + (r'^(?P<path>(?:images|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT+'ietf/'}), |
| 83 | + ) |
| 84 | + ) |
| 85 | + |
| 86 | +# This is needed to serve files which are not handled by collectstatic : |
| 87 | +# if settings.SERVER_MODE in ('development', 'test'): |
| 88 | +# urlpatterns += patterns('', |
| 89 | +# (r'^(?P<path>(?:images|css|js|test|static)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}), |
| 90 | +# (r'^(?P<path>admin/(?:img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}), |
| 91 | +# (r'^(?P<path>secretariat/(img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}), |
| 92 | +# (r'^(?P<path>robots\.txt)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL+"dev/"}), |
| 93 | +# (r'^_test500/$', lambda x: None), |
| 94 | +# (r'^environment/$', 'ietf.help.views.environment'), |
| 95 | +# ) |
0 commit comments