Rename application in Django Admin

Asked

Viewed 712 times

1

Good evening guys, I’m trying to rename the application in Django admin according to the documentation, but it ended up not happening, I think I’m doing something wrong, the code is as follows:

controledebolsists/ 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 'Importarror: No module named 'controledebolsistas', I think I’m doing something wrong, I need some import in these files?? I am new with Jango and who can help me I thank you!! '

  • Put the app on INSTALLED_APPS in the file Settings.py. Already done?

  • So the application already created is in INSTALLED_APPS as 'gestaobolsistas.controledebolsistas', and according to the documentation would have to add 'controledebolsistas.apps.'

  • But it didn’t work

  • it continuing showing that there is no module named 'controledebolsistas'

  • Put here the documentation link you accessed.

  • https://docs.djangoproject.com/en/1.7/ref/applications/#for-application-users

  • The file is init.py with double underlined or you misspelled? There’s only one up there at the beginning.

  • I wrote that way because when I typed in the question I was not accepting

  • Try to see if it works by putting the project name before the app name in default_app_config.

  • It didn’t work, I guess he didn’t recognize the init.py

  • Make a test by putting only 'controledebolsistas' in INSTALLED_APPS

  • @Walkyrrosa how is the directory structure of your project?

  • System/gestaobolsistas/controledebolsistas, it’s like this! gestaobolsistas is created project and control of scholarship is the application

  • Ever tried to put 'gestaobolsitas.controledebolsistas.apps.ControledebolsistasConfig'?

Show 9 more comments

2 answers

0

To include the application in the project, you must 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? Then your punctuated path is 'Controledebolsistas.apps.Controledebolsistasconfig'. Edit the file Settings.py and add that path with dot notation. The INSTALLED_APPS definition. 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',
]

0

Place 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',
]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.