Closed hr23232323 closed 1 year ago
Hello @hr23232323,
Seeing this just now as I visit this repo again.
There's a test_project
in this repository, where a HeroAPIKey(AbstractAPIKey)
is declared, and at the time the migration was generated in the migrations
folder of the heroes
app: https://github.com/florimondmanca/djangorestframework-api-key/blob/master/test_project/heroes/migrations/0001_initial.py
I'm not sure what might be making Django generate migrations in site-packages
rather than in-project. Is there a Django setting to tweak on your side to fix this?
Hello @florimondmanca
I was following the instructions in the customization section of the user guide docs and getting slightly confused about the model generating migration(s).
Additional Details
As far as I can tell, when creating a custom API key model (which inherits from
AbstractAPIKey
) a migration is generated and stored insite-packages
folder (ex path:/home/django/.local/lib/python3.10/site-packages/rest_framework_api_key/migrations/0005_auto_20220110_1102.py
).This means that no django migration is present in the repository (
site-packages
folder is usually ignored). Is this expected or am I doing something wrong?Issue(s)
sqlite3.OperationalError: no such table: rest_framework_api_key_<custom api key name>
Discussion
site-packages
folder to the local django migrations folder? Will this cause any issues?