将Wagtail集成为Django项目中的应用程序时如何设置项目根URL [英] How to set the project root url when Wagtail is integrated as an app in a Django-project
问题描述
我正在将Wagtail集成到预先存在的Django项目中.我的项目树如下:
I'm integrating Wagtail in a pre-existing Django project. My project tree is as follows:
/adjangoproject/
/anapp
/blog/
urls.py
/anotherapp
urls.py
我的 adjangoproject/urls.py
urlpatterns = patterns('',
url(r'^blog/', include('geonode.blog.urls')),
[...]
我的 adjangoproject/blog/urls.py
urlpatterns = patterns('',
url(r'^cms/', include(wagtailadmin_urls)),
url(r'', include(wagtail_urls)),
)
[adjangoproject_rooturl]/blog/cms
正确显示wagtail管理员时,路径 [adjangoproject_rooturl]/blog/
(应为我的wagtail博客的页面提供服务的基本位置)给出:
While [adjangoproject_rooturl]/blog/cms
correctly shows the wagtail admin, the path [adjangoproject_rooturl]/blog/
(the base location where the pages of my wagtail blog shall be served) gives:
Request Method: GET
Request URL: http://127.0.0.1:8000/blog/
Raised by: wagtail.wagtailcore.views.serve
你能帮我吗?
推荐答案
您需要确保已在管理员的设置"->站点"下设置了站点"记录.默认情况下应该创建一个,但是如果您删除了初始主页并创建了一个新主页来替换它,则该主页将丢失,并且需要设置一个新主页.
You need to make sure you have a Site record set up in the admin, under Settings -> Sites. There should be one created by default, but if you deleted the initial homepage and created a new one to replace it, this will have been lost, and you'll need to set up a new one.
这篇关于将Wagtail集成为Django项目中的应用程序时如何设置项目根URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!