''You are seeing this page because DEBUG=True is in your settings file and
you have not configured any URLs.''
This message is confusing as I'm running Django with DEBUG=False.
Also I have configured URLs, but they are not at the root of the project.
I believe that this message should be improved and stating that a the user
should configure a route to replace the default page.
--
Ticket URL: <https://code.djangoproject.com/ticket/30825>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "django-home-page-debug-message.png" added.
default home page
Old description:
> When having no home page configured and when running the configuration
> with DEBUG=False the following message is shown:
>
> ''You are seeing this page because DEBUG=True is in your settings file
> and you have not configured any URLs.''
>
> This message is confusing as I'm running Django with DEBUG=False.
> Also I have configured URLs, but they are not at the root of the project.
>
> I believe that this message should be improved and stating that a the
> user should configure a route to replace the default page.
New description:
When having no home page configured and when running the configuration
with DEBUG=False the following message is shown:
''You are seeing this page because DEBUG=True is in your settings file and
you have not configured any URLs.''
(Check the attachment for a screenshot)
This message is confusing as I'm running Django with DEBUG=False.
Also I have configured URLs, but they are not at the root of the project.
I believe that this message should be improved and stating that a the user
should configure a route to replace the default page.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:1>
Old description:
> When having no home page configured and when running the configuration
> with DEBUG=False the following message is shown:
>
> ''You are seeing this page because DEBUG=True is in your settings file
> and you have not configured any URLs.''
>
> (Check the attachment for a screenshot)
>
> This message is confusing as I'm running Django with DEBUG=False.
> Also I have configured URLs, but they are not at the root of the project.
>
> I believe that this message should be improved and stating that a the
> user should configure a route to replace the default page.
New description:
When having no home page configured and when running the configuration
with DEBUG=False the following message is shown:
''You are seeing this page because DEBUG=True is in your settings file and
you have not configured any URLs.''
(Check the attachment for a screenshot)
This message is confusing as I'm running Django with DEBUG=False.
Also I have configured URLs, but they are not at the root of the project.
I believe that this message should be improved and stating that a the user
should configure a route to replace the default page.
Update: I noticed that for this specific view the engine is forced to be
in debug
[https://github.com/django/django/blob/503f60ff570df5a7b1802cbf0e2e58067c167d95/django/views/debug.py#L22
[source]]
I still believe that the message should be changed in order to communicate
correctly what's going on.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:2>
* owner: nobody => KESHAV KUMAR
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:3>
* status: assigned => closed
* resolution: => worksforme
Comment:
The debug view is **not** shown when `DEBUG=False`. Instead a generic 404
is show.
Unless you can provide reproduce steps, this isn't something we need to
fix.
1. `django-admin startproject ticket_30825`
2. `cd ticket_30825/`
3. Edit `settings.py` with
DEBUG = False
ALLOWED_HOSTS = ['*']
4. `./manage.py runserver`
5. `curl -i http://127.0.0.1:8000`
{{{
HTTP/1.1 404 Not Found
Date: Wed, 02 Oct 2019 14:59:27 GMT
Server: WSGIServer/0.2 CPython/3.7.3
Content-Type: text/html
X-Frame-Options: DENY
Content-Length: 179
X-Content-Type-Options: nosniff
<!doctype html>
<html lang="en">
<head>
<title>Not Found</title>
</head>
<body>
<h1>Not Found</h1><p>The requested resource was not found on this
server.</p>
</body>
</html>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:4>
Comment (by Therry van Neerven):
Replying to [comment:4 Carlton Gibson]:
> The debug view is **not** shown when `DEBUG=False`. Instead a generic
404 is show.
>
> Unless you can provide reproduce steps, this isn't something we need to
fix.
I've checked our project and I found out that the issue was caused by the
configuration of the default_urlconf at the root url:
{{{
from django.contrib import admin
from django.urls import path
from django.views.debug import default_urlconf
urlpatterns = [
path('', default_urlconf),
path('admin/', admin.site.urls),
]
}}}
The problem is caused by the fact that the Template engine is
[https://github.com/django/django/blob/103a6f4307b4402198b03d79c683e195686572e1/django/views/debug.py#L22
different for this view]:
{{{
# Minimal Django templates engine to render the error templates
# regardless of the project's TEMPLATES setting. Templates are
# read directly from the filesystem so that the error handler
# works even if the template loader is broken.
DEBUG_ENGINE = Engine(
debug=True,
libraries={'i18n': 'django.templatetags.i18n'},
)
}}}
I'm in favor of considering this a configuration error from the user's
side. However if a better message can be provided that would be nice.
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:5>
Comment (by Carlton Gibson):
OK, so it's morning, and perhaps I need another coffee, but, I'm
struggling to think of any reasonable circumstances in which this ends up
in your `urls.py`:
{{{
from django.views.debug import default_urlconf
urlpatterns = [
path('', default_urlconf),
# ...
]
}}}
For me, this is so far out of expected practice that:
* You'd need to be beyond beginner to even be able to end up here, and
* So rare as to not merit additional code paths adding an ''better'' error
message.
Nonetheless, do you have a particular patch in mind?
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:6>
Comment (by Therry van Neerven):
Replying to [comment:6 Carlton Gibson]:
> For me, this is so far out of expected practice that:
>
> * You'd need to be beyond beginner to even be able to end up here, and
> * So rare as to not merit additional code paths adding an ''better''
error message.
>
> Nonetheless, do you have a particular patch in mind?
All the patches that I can think of introduce additional complexity.
Since this is an edge case I don't think it is is worthwhile to make
changes to the current implementation.
For that reason I'm fine with leaving this bug closed unless more people
are reporting that they end up in a similar situation.
--
Ticket URL: <https://code.djangoproject.com/ticket/30825#comment:7>