Skip to content

Commit cbaabbf

Browse files
committed
Changed the urls config so that static files can be served to the test client.
- Legacy-Id: 11302
1 parent 2c456ce commit cbaabbf

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

ietf/urls.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from django.views.generic import TemplateView
88
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
99

10+
import debug # pyflakes:ignore
11+
1012
from ietf.liaisons.sitemaps import LiaisonMap
1113
from ietf.ipr.sitemaps import IPRMap
1214
from ietf import api
@@ -76,13 +78,15 @@
7678

7779
# This is needed to serve files during testing
7880
if settings.SERVER_MODE in ('development', 'test'):
79-
urlpatterns += ( staticfiles_urlpatterns()
80-
+ patterns('',
81+
save_debug = settings.DEBUG
82+
settings.DEBUG = True
83+
urlpatterns += staticfiles_urlpatterns()
84+
urlpatterns += patterns('',
8185
(r'^_test500/$', lambda x: None),
8286
(r'^environment/$', 'ietf.help.views.environment'),
8387
## maybe preserve some static legacy URLs ?
8488
(r'^(?P<path>(?:images|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT+'ietf/'}),
8589
)
86-
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
87-
)
90+
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
91+
settings.DEBUG = save_debug
8892

0 commit comments

Comments
 (0)