7

I'm new to Django, and I can't figure out why my app isn't loading. I've created all the files: models.py, views.py, urs.py with default code in. But when I run python manage.py runserver, it says the following:

Error: No module named app_name

What am I doing wrong?

3 Answers 3

9

Did you remember to include __init__.py in your folder?

If you did, make sure the permissions on the file are also correct. There's also a similar question here.

Sign up to request clarification or add additional context in comments.

2 Comments

Ah, that would be it. Thanks!
None of the solutions posted by Herman and swege worked for me.
9

Just an additional hint: Instead of manually creating the files you can use django-admin.py startapp APPNAME to automatically create a directory with all necessary files for a new app.

1 Comment

if you have installed a virtualenv (e.g. through pipenv) you should enable the virtualenv and then use django-admin' without the .py extension
4

I got your point the init file thing also dosen't work out for me as well. Just ensure that are you writing the proper command inside the proper directory while creating the app, using the terminal.

Like while writing the command "django-admin startapp APP_NAME", ensure that the command is written inside your root configuration directory (which gets created after you typein command "django-admin startproject PROJECT-NAME"), not anywhere else. Then mention the app name inside the settings.py file, under the INSTALLED_APPS[ ] list. Then finally run the command "python manage.py runserver" in the same root configuration directory. I assure you, this will work for sure and the "No modules found" thing will disappear. Have a try and tell me if it don't. Thank you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.