Deploy django on CPanel

I setup a Python web app using the feature of CPanel. This works fine, I get the expected output. But story is different with django. django docs does not seem to have something specific to CPanel install. Searched the web and tried many Passenger_wsgy.py files. Typical script looks like so, but it seem some paths are always wrong. Any suggestions

Passenger file:

import os
import sys

import django.core.handlers.wsgi
from django.core.wsgi import get_wsgi_application

# Set up paths and environment variables
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'library.settings'

# Set script name for the PATH_INFO fix below
SCRIPT_NAME = os.getcwd()

class PassengerPathInfoFix(object):
    """
        Sets PATH_INFO from REQUEST_URI because Passenger doesn't provide it.
    """
    def __init__(self, app):
        self.app = app

    def __call__(self, environ, start_response):
        from urllib.parse import unquote
        environ['SCRIPT_NAME'] = SCRIPT_NAME
        request_uri = unquote(environ['REQUEST_URI'])
        script_name = unquote(environ.get('SCRIPT_NAME', ''))
        offset = request_uri.startswith(script_name) and len(environ['SCRIPT_NAME']) or 0
        environ['PATH_INFO'] = request_uri[offset:].split('?', 1)[0]
        return self.app(environ, start_response)

# Set the application
application = get_wsgi_application()
application = PassengerPathInfoFix(application)

Typical error log:

raceback (most recent call last):
  File "/home/mariostg/hello/passenger_wsgi.py", line 31, in <module>
    application = get_wsgi_application()
  File "/home/mariostg/virtualenv/hello/3.8/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/mariostg/virtualenv/hello/3.8/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/mariostg/virtualenv/hello/3.8/lib/python3.8/site-packages/django/conf/__init__.py", line 92, in __getattr__
    self._setup(name)
  File "/home/mariostg/virtualenv/hello/3.8/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/mariostg/virtualenv/hello/3.8/lib/python3.8/site-packages/django/conf/__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/opt/alt/python38/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'library.settings'

Are you trying to do this on Passenger? (Is Channels involved at all here? If not, why is that part of the title?)

If you do a search for “Passenger” here, there have been a couple of discussions where people have provided links to other locations with information that has worked for them.

Grrrr Sorry, don’t know whit the word Channel ended up in the title. I meant CPanel.

Is there supposed to be a link at you italicized here?

Yea, sorry - I meant to link to the seach widget here - the magnifying glass icon in the menu at the top right - Search results for '' - Django Forum

Ahhhh ok I see :). Yes I did, no success, But I just got a message back from my hosting company and this is what they say :

I can see that your account is hosted on a Shared Server. Please note that Django will not run well on a shared hosting platform. If you would like to use Django, I would suggest opting for a Cloud Server. You can check details about Cloud Server here - Managed Canadian Cloud Servers - Web Hosting Canada.

So I reached a dead end.

This site is running on a shared hosting platform as well: https://informatics.center. So I do not agree 100% with that. It looks like you have something wrong with path in your settings. Mine works perfectly fine.

I turns out I managed to make it work. Issue at this time is I cannot upload a picture. Server seem to just hang there then timeout. Maybe a permission issue, not sure.