About Default Auto Field
If you are developing a third-party Django app that is providing any models, always set the default_auto_field
in the apps.py
.
class MyAppConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
# or default_auto_field = "django.db.models.AutoField"
Otherwise, the individual DEFAULT_AUTO_FIELD
setting at a project level will trigger database migration creation in your app whenever it doesn't match your apps' migrations and a developer runs makemigrations
.
Tips and Tricks Programming Django 5.2 Django 4.2 Django 3.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.