Richard Rublev
Richard Rublev

Reputation: 8172

Django,debug True or False

I try to follow tutorial from Udemy,Learning Django from Scratch.I have come to this point enter image description here

OK,then I change DEBUG in settings file to False.After that at localhost

Not Found

The requested URL / was not found on this server.

Why?

Upvotes: 0

Views: 654

Answers (3)

Jahongir Rahmonov
Jahongir Rahmonov

Reputation: 13743

If your question is why you are seeing different response depending on the value of DEBUG, then the answer is that when DEBUG is True, Django will present you with the stack traceback so that you can debug what is going on and fix the problem.

But when the DEBUG is false, it means that your app is live and users can access it. You don't want to show your users all the traceback of your application if some error happens.

If that's not your question, the answer is that you just don't have that path configured in your app.

Hope it helps.

Upvotes: 4

mjschuetze102
mjschuetze102

Reputation: 145

Since there is nothing after localhost:8000, it is trying to look for a url with regex "^/". Your website does not actually have that pattern. The patterns your site does have are provided in the error message "^/store", "^/accounts", etc.

If you were to type localhost:8000/store into the url, it would try and find a matching url following the patterns in the webapp following the "^/store" pattern (presumably named store) store/urls.py.

If you would like to access a page at localhost:8000, you will have to add a new pattern to the list in your root directory's urls.py file.

Upvotes: 0

Laurent LAPORTE
Laurent LAPORTE

Reputation: 22962

It's simple: there is no rule which match the "/" (root) route.

Add one in your urls module.

See: Django 404 error-page not found

Upvotes: 0

Related Questions