wagtail-headless-preview icon indicating copy to clipboard operation
wagtail-headless-preview copied to clipboard

[Documentation] on setting up sites to prevent DisallowedHosts error when deploying

Open david-morris opened this issue 3 years ago • 3 comments

If you don't have any sites configured on Wagtail (very possible if you're running headless) and don't have localhost in your Django ALLOWED_HOSTS, you'll get an error. But you can avoid adding localhost to your ALLOWED_HOSTS by setting up a site.

I figured this out by raising an issue against wagtail, maybe this should go somewhere in the readme?

david-morris avatar May 11 '22 07:05 david-morris

Hey @david-morris,

That makes sense. Would you be able to submit a PR? I figure you're quite well placed to update the README from the point of view of someone who got bit by this

zerolab avatar May 11 '22 09:05 zerolab

Sure, I'll talk Monday with my co-worker who made a migration to fix it automatically.

david-morris avatar May 13 '22 12:05 david-morris

This is often solved by installing the django-cors-headers package and adding its corsheaders to INSTALLED_APPS, or did this not solve the original issue?

berzi avatar Dec 23 '23 13:12 berzi