Rename application in Django Admin
Good night guys, I'm trying to rename the application in django admin according to the documentation, but it ended up having no effect, I think I'm doing something wrong, the code is as follows:
Controledebolsistas/ apps.py
from django.apps import AppConfig
class ControledebolsistasConfig(AppConfig):
name = 'controledebolsistas'
verbose_name = "Controle de Bolsistas"
_init__.py
default_app_config = 'controledebolsistas.apps.ControledebolsistasConfig'
It presents an error 'ImportError: in the module named 'controledebolsistas' , I think I'm doing something wrong, I need some import in those files?? I am new to django and anyone who can help me I thank you!! '
2 answers
To include the application in the project, you need to add the reference to the application configuration class in the INSTALLED_APPS definition. The ControledebolsistasConfig class is in the file: file: 'controledebolsistas/apps.py', right? So your punctuated path is ' Controldebolsistas.apps.Control of the players with config'. Edit the file settings.py and add that path with dot notation. The setting of INSTALLED_APPS. It will look like this:
INSTALLED_APPS = [
'Controledebolsistas.apps.ControledebolsistasConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
Put your application inside INSTALLED_APPS, the rest is correct!!
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'controledebolsistas',
]