django-cors-middleware icon indicating copy to clipboard operation
django-cors-middleware copied to clipboard

corsheaders makes dumpdata management command unavailable

Open gergelypolonkai opened this issue 9 years ago • 8 comments
trafficstars

$ 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.

gergelypolonkai avatar Apr 18 '16 14:04 gergelypolonkai

Thanks for the report. Fix incoming soon.

gustavi avatar Apr 18 '16 15:04 gustavi

This fix is important. It should be handled quickly. Thanks @gergelypolonkai

GuillaumeCisco avatar May 26 '16 12:05 GuillaumeCisco

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.

cwisecarver avatar Jun 13 '16 16:06 cwisecarver

This is really problematic. :-(

mitar avatar Aug 23 '16 20:08 mitar

@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 avatar Jan 18 '17 20:01 IlianIliev

@ilianiliev please submit a better patch.

vhf avatar Jan 18 '17 20:01 vhf

@vhf any comments?

IlianIliev avatar Jan 27 '17 22:01 IlianIliev

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.

IlianIliev avatar Mar 23 '17 23:03 IlianIliev