0
from django.apps import AppConfig
    
    
class AccountConfig(AppConfig):
    name = 'account'

As a whole, I have two files the code above is from apps.py, but it does not work. What and where do I have to import the file apps.py to make my code run?

Gustavo Kawamoto
  • 2,665
  • 18
  • 27

2 Answers2

0

in the settings.py you will see a list called INSTALLED_APPS, you pass it there example

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',


'users.apps.UsersConfig',
 ]

this taken for users apps.py that look like the following

class UsersConfig(AppConfig):
      name = 'users'
  • I made it, but what could be another reason if it does not help? Thank you in advance. – Alexander Romanyeyev Sep 12 '20 at 15:50
  • can you share you setings.py and folder structure. – Hossam Ashraf Sep 13 '20 at 16:17
  • I got trouble with my PC unexpectedly, so as soon as it will be possible) but in advance, let’s say I am using Atom, how to share my folder structure? – Alexander Romanyeyev Sep 13 '20 at 16:45
  • Settings.py """ import os DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'account.apps.AccountConfig' 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] – Alexander Romanyeyev Sep 19 '20 at 18:52
  • can you send you installed apps – Hossam Ashraf Sep 20 '20 at 19:24
  • I have only the apps what I wrote above, or may be I don’t understand something, so could you please explain (like the command) to list all installed apps I' ve tried this, but it didn't work: https://stackoverflow.com/questions/21566919/how-to-list-all-installed-apps-with-manage-py-in-django – Alexander Romanyeyev Sep 20 '20 at 21:52
  • in your setting.py can you show me your installed apps or can you share the project so I can see it for myself. – Hossam Ashraf Sep 22 '20 at 00:41
0

I think you forgot "," after 'account.apps.AccountConfig'

Your code should be like this

INSTALLED_APPS = [
'account.apps.AccountConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
ilhom
  • 1
  • 1