I've started learning Django and struggling with creating/migrating a model. Everytime I try to type python manage.py migrate(or anything), I get the error ModuleNotFoundError: No module named 'People'.
Here's my directory structure;
|- VLCase
|- VLCase
|- models.py
|- urls.py
|- settings.py
|- asgi.py
|- __pycache__
|- wsgi.py
|- manage.py
|- db.sqlite3
Here's my models.py;
from django.db import models
class People(models.Model):
name = models.CharField(max_length=200)
I added People into INSTALLED_APPS;
INSTALLED_APPS = [
'People',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
I couldn't find the answer. I would be greatly appreciated. Thanks in advance.
CodePudding user response:
What you should write in your INSTALLED_APPS
is the name of your application, so in your case it's VLCase
, not People
.
Your People
class only refer to one of the models of your application and doesn't need to be added to your INSTALLED_APPS
.