Forums

Error running WSGI application

Hi, I am trying to deploy my Django app on PA and I keep facing this error with my WSGI file:

2022-02-02 10:36:00,883: Error running WSGI application
2022-02-02 10:36:00,884: django.core.exceptions.ImproperlyConfigured: The app module <module 'asynpep' (namespace)> has multiple filesystem locations (['./asynpep', '/home/PPMCLAB/asynpep/asynpep']); you must configure this app with an AppConfig subclass with a 'path' class attribute.
2022-02-02 10:36:00,884:   File "/var/www/asynpep_ppmclab_com_wsgi.py", line 35, in <module>
2022-02-02 10:36:00,884:     application = get_wsgi_application()
2022-02-02 10:36:00,884: 
2022-02-02 10:36:00,884:   File "/home/PPMCLAB/.virtualenvs/soluphred-env/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2022-02-02 10:36:00,884:     django.setup(set_prefix=False)
2022-02-02 10:36:00,884: 
2022-02-02 10:36:00,884:   File "/home/PPMCLAB/.virtualenvs/soluphred-env/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
2022-02-02 10:36:00,884:     apps.populate(settings.INSTALLED_APPS)
2022-02-02 10:36:00,884: 
2022-02-02 10:36:00,884:   File "/home/PPMCLAB/.virtualenvs/soluphred-env/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
2022-02-02 10:36:00,884:     app_config = AppConfig.create(entry)
2022-02-02 10:36:00,884: 
2022-02-02 10:36:00,885:   File "/home/PPMCLAB/.virtualenvs/soluphred-env/lib/python3.7/site-packages/django/apps/config.py", line 110, in create
2022-02-02 10:36:00,885:     return cls(entry, module)
2022-02-02 10:36:00,885: 
2022-02-02 10:36:00,885:   File "/home/PPMCLAB/.virtualenvs/soluphred-env/lib/python3.7/site-packages/django/apps/config.py", line 40, in __init__
2022-02-02 10:36:00,885:     self.path = self._path_from_module(app_module)
2022-02-02 10:36:00,885: 
2022-02-02 10:36:00,885:   File "/home/PPMCLAB/.virtualenvs/soluphred-env/lib/python3.7/site-packages/django/apps/config.py", line 73, in _path_from_module
2022-02-02 10:36:00,885:     "with a 'path' class attribute." % (module, paths))

The WSGI file looks like this:

import os
import sys

path = '/home/PPMCLAB/asynpep'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'asynpep.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

I have deployed other apps in the past with the same procedure and it worked perfectly, so I don't know what's happening now. I have my manage.py and setting.py files under the proper subdirectories.

Thanks in advance

Your django project is definitely misconfigured. How does your django project structure look like?

I was able to figured it out. The app module name of the project was saved as 'INSTALLED_APPS' under the setting.py file. I guess that's the reason it detected the module in multiple locations. I removed it and now it works. Thanks!

Great! Very glad to hear you worked it out :-)