What is the problem with my wsgi.py file?

Howdy,

I’m trying to get mezzanine to run on my shared server. I’m using the ‘Python App’ feature on cpanel.

I’m getting the following error when I try and run it:

modulenotfounderror: No Module Named 'petfood.settings’

The project is named ‘petfood’

I’m assuming the wsgi.py is the problem.


import os

from django.core.wsgi import get_wsgi_application

from mezzanine.utils.conf import real_project_name

os.environ.setdefault(
    "DJANGO_SETTINGS_MODULE", "%s.settings" % real_project_name("petfood")
)

application = get_wsgi_application()

Any ideas?

Can you share the folder structure of your project

Well, you need to check the Python path, permissions, and a virtual environment and then try again. If still not work then contact to support team.
Thanks

Yeah!

I’ve since deleted the app and reinstalled it, it’s still giving me the same issue.

Here is the file structure


/home
  /user
     /Mezzanine
          -__init__.py
          -passenger_wsgi.py
          /petfood
               -__init__.py
               -manage.py
               /petfood
                    -__init__.py
                    -wsgi.py
                    -settings.py

Here is the contents of the passenger_wsgi.py

from petfood.petfood.wsgi.py import application

Here is the contents of the wsgi.py

import os

from django.core.wsgi import get_wsgi_application

from mezzanine.utils.conf import real_project_name

os.environ.setdefault(
    "DJANGO_SETTINGS_MODULE", "%s.settings" % real_project_name("petfood")
)

application = get_wsgi_application()

Here is a screen shot of Cpanel Python App settings

In wsgi.py Try petfood.petfood.settings

os.environ.setdefault(
    "DJANGO_SETTINGS_MODULE", "petfood.petfood.settings" )
)