26👍
✅
Import your views directly, or your views modules:
from apps.views import about
from accounts import views as account_views
Do not use patterns
at all, just use a list or tuple:
urlpatterns = [
url(r'^about/$', about,
name='about'),
]
urlpatterns += [
url(r'^signin/$', account_views.auth_login,
name='login'),
]
4👍
You should remove the quotes around views name.
So your code will be like that
urlpatterns = patterns('',
url(r'^about/$', app.views.about, #without quote!
name='about'),
)
Point 2, use lists, so your code will transform to
urlpatterns = [
url(r'^about/$', app.views.about, #without quote!
name='about'),
]
- [Django]-Django middleware difference between process_request and process_view
- [Django]-Django REST Framework : "This field is required." with required=False and unique_together
- [Django]-How to merge consecutive database migrations in django 1.9+?
Source:stackexchange.com