当我不使用“127.0.0.1:8000”时找不到 django wagtail 页面

django wagtail page not found when i don't use "127.0.0.1:8000"

我已将以下内容添加到我的 settings.py

ALLOWED_HOSTS = ['0.0.0.0','127.0.0.1','192.168.0.05']

我的url.py

urlpatterns = [
url(r'^django-admin/', include(admin.site.urls)),

url(r'^admin/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),

#url(r'^search/$', search_views.search, name='search'),

# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in
# the list:
#url(r'', include(wagtail_urls)),

# Alternatively, if you want Wagtail pages to be served from a subpath
# of your site, rather than the site root:
#    url(r'^pages/', renders(wagtail_urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),

]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += i18n_patterns(
# These URLs will have /<language_code>/ appended to the beginning
url(r'^search/$', search_views.search, name='search'),
url(r'', include(wagtail_urls)),
#url(r'^$', include(wagtail_urls)),
 )

问题是当我在同一个局域网上从我的手机 phone 或什至从其托管的笔记本电脑上执行“http://127.0.0.1:8000/en" it works just fine however when I do "http://192.168.0.5:8000/en/”时,我不断收到 "Page not found (404)".

我在 url.py 中忽略了什么会导致这种行为的原因。

我试过 运行 如下:

python manage.py runserver 192.168.0.13:8000
python manage.py runserver 0.0.0.0:8000

这些都没有帮助。

我知道这不是防火墙问题,因为找不到页面是 Django 服务响应的结果。

在 Wagtail 管理中的“设置”->“站点”下检查站点记录。当收到请求时,如果主机名与站点记录中指定的主机名匹配,或者选中 'is default site' 框,Wagtail 只会提供一个页面。