Disable admin application for django

Question:

I am trying to run the django development server and its failed with below error.

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/my/virtual/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/my/virtual/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/my/virtual/environment/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/my/virtual/environment/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/my/virtual/environment/lib/python3.8/site-packages/django/core/management/base.py", line 469, in check
    raise SystemCheckError(msg)
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
?: (admin.E403) A 'django.template.backends.django.DjangoTemplates' instance must be configured in TEMPLATES in order to use the admin application.

this is django-rest-framework application and it has no admin application.

How to say django runserver to not run admin application?

Asked By: Nilesh

||

Answers:

The solution is not to change how manage.py runserver behaves, but to reconfigure your Django site. Essentially, you want to do the reverse of enabling the admin app.

The most important step is to remove django.contrib.admin from your INSTALLED_APPS. You should also remove django.contrib.auth.middleware.AuthenticationMiddleware from your MIDDLEWARE if it is present.

You may also want to remove the auth, messages, and sessions apps, though you may need them for other reasons. You’ll have to make that call yourself based on what your application does.

Answered By: Chris
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.