1👍
✅
The solution was quite counterintuitive. You have to delete the
class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = "accounts"
from apps.py\accounts\apps\mysite. Then run python manage.py makemigrations
and 2 new models ‘UserPersona
‘ and ‘UserProfile
‘ are created. the output in the terminal:
mysite\apps\accounts\migrations\0001_initial.py
- Create model UserPersona
- Create model UserProfile
34👍
The name
in apps.py
should be the same (value) that you put in INSTALLED_APPS
(in settings.py
). That’s the correct one.
from django.apps import AppConfig
class AccountsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "mysite.apps.accounts"
settings.py
code:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mysite.apps.accounts',
]
- How to call serializer's create() method from one serializer
- Rename response fields django rest framework serializer
- Querying Many to many fields in django template
0👍
The name in AppConfig should be same as the name provided in Installed Apps i.e., it should be "mysite.apps.accounts".
- How to setup APScheduler in a Django project?
- Django User model email field: how to make it mandatory
- Making Django Readonly ForeignKey Field in Admin Render as a Link
- Django – OperationalError: (2006, 'MySQL server has gone away')
- Cookies across subdomains and hosts
-1👍
To define new app you do not need to add it’s path just
app it’s name like that 'accounts'
note that app name is case sensitive
so your installed app became :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts',
]
- How to create a 8 digit Unique ID in Python?
- No Such Column Error in Django App After South Migration
- TypeError at /en/ Object of type '__proxy__' is not JSON serializable
- Paypal monthly subscription plan settings for first day of the month and making monthly recurring payment – django python
Source:stackexchange.com