Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Django ModuleNotFoundError after creating models

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;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading