[Answer]-How to set the index page in django like http://127.0.0.1:8000/

1👍

Can you change what you have here

url(r'^polls/',include('polls.urls',namespace="polls")),   

to

url(r'^', include('polls.urls', namespace="polls")),

Now the reason is this:
Django urls uses regex. In your example, you’re telling django to catch your polls app, beginning from the url as localhost:8000/polls/

Learn more: https://docs.djangoproject.com/en/dev/topics/http/urls/

Even in your root project urls.py, you’ve got this:

# Examples:
    # url(r'^$', 'Toolkit.views.home', name='home'), #this will match url of the type localhost:8000
    # url(r'^blog/', include('blog.urls')), # this will match url of the type localhost:8000/blog/

Just look sharp!

👤KhoPhi

Leave a comment