4👍
Your url pattern index
is catching all urls. This means that any url patterns below will be ignored.
url('^.*$', IndexView.as_view(), name='index'),
To match only the index (i.e. http://127.0.0.1:8000/
), change it to
url(r'^$', IndexView.as_view(), name='index'),
Note that I’ve also added the r''
prefix to the regex. It doesn’t make any difference in this case, but it’s a good habit to use it in your regexes.
- [Django]-Amazon EC2 Deployment Not Working When IP Address Typed Into Browser Suspect Ngnix Problems
0👍
In MyProj/urls.py
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url('^$', IndexView.as_view(), name='index'),
url(r'^questions$', views.home, name='home'),
]
questions/urls.py:
urlpatterns = [
url(r'^$', views.home, name='home'),
]
questions/views.py
def home(request):
return render(request, "questions/home.html", {})
- [Django]-Django startapp admin file missing
- [Django]-Uploading image in django: getting "global name context is not defined" error
- [Django]-ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory
- [Django]-Django/django-tables2 html table on row click to edit form
Source:stackexchange.com