简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM