OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

( django.core.exceptions.ImproperlyConfigured: Cannot import 'apps.accounts'. Check that 'mysite.apps.accounts.apps.AccountsConfig.name' is correct

  • Thread starter Thread starter Jeremi
  • Start date Start date
J

Jeremi

Guest
This is how it is structured The apps.py file is under apps which is under mysite The code inside apps.py of accounts folder file is

Code:
from django.apps import AppConfig
class AccountsConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = "apps.accounts"

The code inside Settings is

Code:
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'mysite.apps.accounts',
]

I tried changing 'mysite.apps.accounts', to 'mysite.apps.AccountsConfig', and changing name = "apps.accounts" to name = "accounts" I am new to Django and was following How to make a website with Python and Django - MODELS AND MIGRATIONS (E04) tutorial. Around 16:17 is where my error comes up when I enter python manage.py makemigrate to the vscode terminal The error is

ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Cannot import 'apps.accounts'. Check that 'mysite.apps.accounts.apps.AccountsConfig.name' is correct. Someone please help me.
<p>This is how it is structured <a href="https://i.sstatic.net/YOa54.jpg" rel="noreferrer"><img src="https://i.sstatic.net/YOa54.jpg" alt="The apps.py file is under apps which is under mysite" /></a>
The code inside <strong>apps.py</strong> of <strong>accounts folder</strong> file is</p>
<pre><code>from django.apps import AppConfig
class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = "apps.accounts"
</code></pre>
<p>The code inside Settings is</p>
<pre><code>INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mysite.apps.accounts',
]
</code></pre>
<p>I tried changing <code>'mysite.apps.accounts',</code> to <code>'mysite.apps.AccountsConfig',</code>
and changing <code>name = "apps.accounts"</code> to name = <code>"accounts"</code>
I am new to Django and was following <a href="
" rel="noreferrer">How to make a website with Python and Django - MODELS AND MIGRATIONS (E04)</a> tutorial. Around <a href="
" rel="noreferrer">16:17</a> is where my <strong>error</strong> comes up when I enter <code>python manage.py makemigrate</code> to the vscode terminal
The error is</p>
<blockquote>
<p>ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured:
Cannot import 'apps.accounts'. Check that
'mysite.apps.accounts.apps.AccountsConfig.name' is correct.
Someone please help me.</p>
</blockquote>
 

Latest posts

Online statistics

Members online
1
Guests online
4
Total visitors
5
Top