Answer the question
In order to leave comments, you need to log in
What to use instead of patterns in django 1.10?
Hello, in previous versions of janga, for statics, you had to add to urls.py
from django.conf.urls import patterns
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
)
Answer the question
In order to leave comments, you need to log in
Patterns are now regular lists
urlpatterns = [
url(r'^$', some_view),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question