Search code examples
djangodjango-admin

disable default Django models and migrations


I created a Django project which is supposed to be a small service and it has nothing to do with User and other Django default models. How can I remove them completely? (I need Django admin) When I comment django.contrib.auth in INSTALEDD_APPS I recieve this error:

RuntimeError: Model class django.contrib.auth.models.Permission doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.


Solution

  • To clarify here. Django includes a user with all requests. This may well be an anonymous user if nobody is logged in, but it's there. Trying to disentangle this is almost certainly not worth it.

    Either:

    a. Leave the user/auth stuff there and simply don't use it, which means the is_authenticated method will always return False.

    b. Pick a different framework, or at least think carefully about what you want from a framework. Why have you picked Django for this when you don't want the features of Django in the first place?