ModuleNotFoundError: No module named 'mysite'

Hello!

I’m working on a python virtual environment:

  • Python 3.13.1
  • Django 5.1.6
  • At this moment without apps, just the project.

I’m trying to start the project with “runserver”, or I try to run makemigrations, or I try to run migrate, and I get this message: ModuleNotFoundError: No module named ‘mysite’

I’ve searched in my settings file, even in wsgi file and I see everything well. I’ve searched on Internet a lot of forums without success.

I changed Django version, without success, the same message.

I’ve created a lot of projects and I get this message for first time.

Kind regards.

Hello!

You probably have a "mysite" in your settings.py in the INSTALLED_APPS list without having created the app first, although I can’t be sure without seeing settings.py anf your project directory tree.

Hello, @cliff688

No, I haven’t “mysite” app. It is a simple project like Django project:

project/
    manage.py
    project_one/
        __init__.py
        settings.py
        urls.py
        asgi.py
        wsgi.py

But, I’m thinking that the problem can be the Python virtual environment. I’ll check that.

If I get the error and a solution, I’ll put here the solution.

Kind regards.

Welcome @nuxpy

That’s not the problem here.

As mentioned above, the root issue is that you almost certainly have an entry in your INSTALLED_APPS setting for 'mysite'.

Please post your INSTALLED_APPS setting from your settings.py file.
Also post the contents of your manage.py file.

Finally, when you’re asking for assistance with an error message, always post the complete message with the traceback from the console. Do not try to summarize or otherwise edit the error.

Side note: When posting code, templates, logs, error messages, html, or other preformatted text here, enclose the code (etc) between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.
(I’ve fixed your directory listing for this already.)

Hello, @KenWhitesell

No, there was “mysite” in my INSTALLED_APPS on setting file.

By the way, I created the environment directory again and it works.

Thank you.