florimondmanca / djangorestframework-api-key

🔐 API key permissions for Django REST Framework
https://florimondmanca.github.io/djangorestframework-api-key/
MIT License
669 stars 103 forks source link

Migration file in `site-packages` folder for generating a custom API Key model #232

Closed hr23232323 closed 1 year ago

hr23232323 commented 1 year ago

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 in site-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)

Discussion

florimondmanca commented 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?