How to set the project root url when Wagtail is integrated as an app in a Django-project

点点圈 提交于 2019-12-24 08:06:33

问题


I'm integrating Wagtail in a pre-existing Django project. My project tree is as follows:

/adjangoproject/
    /anapp
    /blog/
       urls.py
    /anotherapp
    urls.py

My adjangoproject/urls.py

urlpatterns = patterns('',
                      url(r'^blog/', include('geonode.blog.urls')),
                      [...]

My adjangoproject/blog/urls.py

urlpatterns = patterns('',
    url(r'^cms/', include(wagtailadmin_urls)),
    url(r'', include(wagtail_urls)),
)

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

Could you help me?


回答1:


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.



来源:https://stackoverflow.com/questions/40635608/how-to-set-the-project-root-url-when-wagtail-is-integrated-as-an-app-in-a-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!