I have a clean install of Saleor and integrated Wagtail with it.
When I try to see a wagtail page I get an exception at the wagtail end at:
.virtualenvs/srt/lib/python3.6/site-packages/wagtail/wagtailcore/views.py in serve, line 19
Cannot query "localhost:8000": Must be "Site" instance.
Also if I want to access the page from the front with a url I get:
AttributeError at /pages/
'Site' object has no attribute 'root_page'
I am asking since I saw that you are using Wagtail from a twitter post.
Hope you have a solution for that.
Also if you have a working recipe of how to implement Saleor and Wagtail together It would be appreciated!
It's been some time since we used these two together. It looks like there is a conflict now between wagtail.core.middleware.SiteMiddleware and saleor.core.middleware.ClearSiteCacheMiddleware. You could try moving the Saleor middleware one above the Wagtail one but I'm not sure if that will fix it or if that's the only incompatibility today.
Thank you I will try it out.Do you recommend another CMS that works out of the box with saleor?
Sent from Yahoo Mail for iPhone
On Tuesday, December 5, 2017, 18:53, Patryk Zawadzki notifications@github.com wrote:
It's been some time since we used these two together. It looks like there is a conflict now between wagtail.core.middleware.SiteMiddleware and saleor.core.middleware.ClearSiteCacheMiddleware. You could try moving the Saleor middleware one above the Wagtail one but I'm not sure if that will fix it or if that's the only incompatibility today.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Sadly, no, if I required a full-fledged CMS (our customers are often fine with just a WYSIWYG editor + django.contrib.flatpages), Wagtail would likely be my first choice.
I'll keep this open as I'm interested to see what other challenges you face while trying to use Saleor with Wagtail. Hopefully we can adapt to make it easier, document the necessary adaptations or even have it working our of the box.
Changing the order of the middleware classes did the trick. It all seems to work fine now. If something comes up I will post.
Hello,
I tried to integrate Wagtail with Saleor and it works but I can't see Add page option in Pages which is weird. Anyone facing the same issue? Permissions seem to be ok for admin user, maybe it's Wagtail bug?
I am going to try to convert saleor models to wagtail page and editable through admin and rendered using wagtail django templates. if i can do so, i will open source that
Closing this since we're not going to work on any integration with Wagtail for now.
The problem is that Saleor uses Django.contrib.sites Site model (1to1 link with saleor.site.SiteSettings) and Wagtail uses its own version wagtail.core.models.Site, and both frameworks expect the Site object they use to be available at request.path..
I worked out this issue by tweaking saleor.core.middelware.site to only modify request.site if we are not visiting a wagtail url (by checking request.path), there are only 2 paths you have to consider, the admin served by 'wagtailadmin_home' (and subpaths) and the pages served by 'wagtail_serve'. Make sure to place the wagtail site middleware before this customized one and thats it, at the admin or when serving pages request.site will have the object wagtail needs, and for the rest it will have the site object saleor needs
@AguD thanks for the tip, works really well
Most helpful comment
The problem is that Saleor uses Django.contrib.sites Site model (1to1 link with saleor.site.SiteSettings) and Wagtail uses its own version wagtail.core.models.Site, and both frameworks expect the Site object they use to be available at request.path..
I worked out this issue by tweaking saleor.core.middelware.site to only modify request.site if we are not visiting a wagtail url (by checking request.path), there are only 2 paths you have to consider, the admin served by 'wagtailadmin_home' (and subpaths) and the pages served by 'wagtail_serve'. Make sure to place the wagtail site middleware before this customized one and thats it, at the admin or when serving pages request.site will have the object wagtail needs, and for the rest it will have the site object saleor needs