serve static files for development
This commit is contained in:
Родитель
93d7493556
Коммит
3bedd697b9
13
urls.py
13
urls.py
|
@ -1,9 +1,6 @@
|
|||
from django.conf import settings
|
||||
from django.conf.urls.defaults import *
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
# from django.contrib import admin
|
||||
# admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# Example:
|
||||
# (r'^zamboni/', include('zamboni.foo.urls')),
|
||||
|
@ -15,3 +12,11 @@ urlpatterns = patterns('',
|
|||
# Uncomment the next line to enable the admin:
|
||||
# (r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
# Remove leading and trailing slashes so the regex matches.
|
||||
media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
|
||||
urlpatterns += patterns('',
|
||||
(r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve',
|
||||
{'document_root': settings.MEDIA_ROOT})
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче