谁生成django欢迎页面的默认页面? [英] Who generates the default page of django welcome page?
问题描述
我刚刚设置了django环境,正如教程所说.我输入了 python manager.py runserver
,它告诉我打开 127.0.0.1:8000
.当我打开它时,它与正确的欢迎页面一起工作.
I just set up the django environment and as the tutorial said. I typed python manager.py runserver
and it told me to open 127.0.0.1:8000
. When I open it, it worked with the correct welcome page.
但这是我的问题:谁生成了这个默认的欢迎页面?由于没有 views.py
并且 urls.py
页面是空的.
But here is my question: who generates this default welcome page? Since there is no views.py
and the urls.py
page is empty.
推荐答案
看一看 django/core/handlers/base.py
和 django/views/debug.py代码>.简而言之,如果 django 得到 404,如果你没有设置任何路由,那么在 base.py
Take a look at django/core/handlers/base.py
and django/views/debug.py
. In a nutshell, if django gets a 404, which it will if you don't have any routes set up, then in base.py
if settings.DEBUG:
from django.views import debug
response = debug.technical_404_response(request, e)
在 debug.py 中查看 technical_404_response
和 empty_urlconf
And in debug.py look at technical_404_response
and empty_urlconf
这篇关于谁生成django欢迎页面的默认页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!