I'm new to Django and python in general and i'm trying to set up a RESTful api using Django and Django Rest Framework, so my problem is that i want to get rid of the default installed apps, something like this:
INSTALLED_APPS = [
#'django.contrib.admin',
#'django.contrib.auth',
#'django.contrib.contenttypes',
#'django.contrib.sessions',
#'django.contrib.messages',
#'django.contrib.staticfiles',
'rest_framework',
'myapp',
]
since i want a simple api (with no UI) that provides me with some data. But when i run python manage.py makemigrations
i get the following error:
LookupError: No installed app with label 'admin'
does this mean these apps are essential?
Thanks in advance.
Keep in mind that Django Rest Framework inherit a lot from Django, and if you are using other packages they likely do the same too; you are free to remove some apps (e.g. django.contrib.sessions
if you your are not going to use them) but it depends on what you are going to do in your project.
In particular the error you are referring to is caused by the removal of django.contrib.admin
which provides the admin interface for your project, very useful in the development phase. You can read more about it here.
If you have created your app with the standard django-admin startproject
and django-admin startapp
by default you are importing the admin app form urls.py and admin.py files with this line of code:
from django.contrib import admin
Just get rid of it (and the consequent code in admin.py and urls.py which is referring to the admin app) and the error should go away.
Each application has its own purpose. You can learn more about that here:
django.contrib.admin
: documentation;django.contrib.auth
: documentation;django.contrib.contenttypes
: documentation;django.contrib.sessions
: documentation;django.contrib.messages
: documentation;django.contrib.staticfiles
: documentation.Once you understood the purpose of each app and having clear the features of your project and the packages you'll be using you can choose which applications are to be removed; although at least for the beginning, while you are learning, i personally suggest you to simply keep all of them just to be safe, considering that they are providing very basic functionalities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With