Forums

WSGI Application can't find urls.py file

Whenever I load my webapp, the error log outputs with this:

Error running WSGI application 2021-11-29 12:01:58,129: ModuleNotFoundError: No module named 'my-project.urls'

Any ideas on how to solve this?

my-project is not a valid Python module name. Remove the -

the my-project is just a placeholder for my actual project name as I want to keep the project name anonymous

the actual project name has no dash/hyphen

This is my project structure currently:

/myproject
    /scripts
    /webapp
          --manage.py
           /webapp
                  --settings.py
                  --urls.py

And the WSGI app cannot find my urls.py file

We have a help page here that includes a section on how Python finds modules that you're trying to import.

In your case, urls.py is not in myproject, it's in myproject.webapp.webapp