django-cors-middleware
django-cors-middleware copied to clipboard
corsheaders makes dumpdata management command unavailable
$ python manage.py dumpdata
CommandError: Unable to serialize database: relation "corsheaders_corsmodel" does not exist
LINE 1: ...smodel"."id", "corsheaders_corsmodel"."cors" FROM "corsheade...
Manually running makemigrations also doesn’t help, because there is no migrations module exists under corsheaders. I know from the sources that it is optional (and undocumented!) to use a model for whitelisting, but bricking management commands is not a Good Way To Go™
Adding corsheaders/migrations/__init__.py solves the problem, though.
Thanks for the report. Fix incoming soon.
This fix is important. It should be handled quickly. Thanks @gergelypolonkai
I just ran python manage.py makemigrations corsheaders && python manage.py migrate corsheaders and it created the migrations and applied them. The dumpdata --all command worked then.
This is really problematic. :-(
@vhf Sorry, I think I am missing something here. Why are you adding empty migration instead of a real one? Also why does the model even exists as it is never populated with data?
@ilianiliev please submit a better patch.
@vhf any comments?
I just found out that I have made a mistake and the migrations were not actually installed which led to issues when running some commands e.g. flush. However the PR is now updated and working.