问题
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