Re: ModuleNotFoundError: No module named [project_name]

2021-12-15 Thread Muhammad Juwaini Abdul Rahman
It seems that you don't have permission to execute your wsgi.py file or the
filepath is incorrect.

Suggestion: Why don't you use nginx + gunicorn?

On Wed, 15 Dec 2021 at 23:05, Kyle Paterson 
wrote:

> I am using django 4.0 with Apache and mod_wsgi. Whenever I try request the
> site through apache, I get the following error:
> [Wed Dec 15 14:51:59.385259 2021] [wsgi:info] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535,
> process='traveldata', application='127.0.1.1|'): Loading Python script file
> '/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
> [Wed Dec 15 14:51:59.385699 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535): Failed to
> exec Python script file
> '/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
> [Wed Dec 15 14:51:59.385718 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535): Exception
> occurred processing WSGI script
> '/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
> [Wed Dec 15 14:51:59.385800 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] Traceback (most recent call
> last):
> [Wed Dec 15 14:51:59.385828 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 19, in
> 
> [Wed Dec 15 14:51:59.385831 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] application =
> django.core.handlers.wsgi.WSGIHandler()
> [Wed Dec 15 14:51:59.385836 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py",
> line 127, in __init__
> [Wed Dec 15 14:51:59.385838 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] self.load_middleware()
> [Wed Dec 15 14:51:59.385842 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/core/handlers/base.py",
> line 39, in load_middleware
> [Wed Dec 15 14:51:59.385844 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] for middleware_path in
> reversed(settings.MIDDLEWARE):
> [Wed Dec 15 14:51:59.385847 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
> line 84, in __getattr__
> [Wed Dec 15 14:51:59.385849 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] self._setup(name)
> [Wed Dec 15 14:51:59.385859 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
> line 71, in _setup
> [Wed Dec 15 14:51:59.385861 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] self._wrapped =
> Settings(settings_module)
> [Wed Dec 15 14:51:59.385864 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
> line 179, in __init__
> [Wed Dec 15 14:51:59.385866 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] mod =
> importlib.import_module(self.SETTINGS_MODULE)
> [Wed Dec 15 14:51:59.385869 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File
> "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
> [Wed Dec 15 14:51:59.385871 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654] return
> _bootstrap._gcd_import(name[level:], package, level)
> [Wed Dec 15 14:51:59.385875 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 1014, in _gcd_import
> [Wed Dec 15 14:51:59.385878 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 991, in _find_and_load
> [Wed Dec 15 14:51:59.385882 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 961, in _find_and_load_unlocked
> [Wed Dec 15 14:51:59.385886 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 219, in _call_with_frames_removed
> [Wed Dec 15 14:51:59.385889 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 1014, in _gcd_import
> [Wed Dec 15 14:51:59.385893 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 991, in _find_and_load
> [Wed Dec 15 14:51:59.385896 2021] [wsgi:error] [pid 15535:tid
> 140431892707072] [remote 127.0.0.1:44654]   File " importlib._bootstrap>", line 973

ModuleNotFoundError: No module named [project_name]

2021-12-15 Thread Kyle Paterson
I am using django 4.0 with Apache and mod_wsgi. Whenever I try request the 
site through apache, I get the following error:
[Wed Dec 15 14:51:59.385259 2021] [wsgi:info] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535, 
process='traveldata', application='127.0.1.1|'): Loading Python script file 
'/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
[Wed Dec 15 14:51:59.385699 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535): Failed to 
exec Python script file 
'/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
[Wed Dec 15 14:51:59.385718 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535): Exception 
occurred processing WSGI script 
'/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
[Wed Dec 15 14:51:59.385800 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] Traceback (most recent call last):
[Wed Dec 15 14:51:59.385828 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 19, in 

[Wed Dec 15 14:51:59.385831 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] application = 
django.core.handlers.wsgi.WSGIHandler()
[Wed Dec 15 14:51:59.385836 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py",
 
line 127, in __init__
[Wed Dec 15 14:51:59.385838 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] self.load_middleware()
[Wed Dec 15 14:51:59.385842 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/core/handlers/base.py",
 
line 39, in load_middleware
[Wed Dec 15 14:51:59.385844 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] for middleware_path in 
reversed(settings.MIDDLEWARE):
[Wed Dec 15 14:51:59.385847 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
 
line 84, in __getattr__
[Wed Dec 15 14:51:59.385849 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] self._setup(name)
[Wed Dec 15 14:51:59.385859 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
 
line 71, in _setup
[Wed Dec 15 14:51:59.385861 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] self._wrapped = 
Settings(settings_module)
[Wed Dec 15 14:51:59.385864 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
 
line 179, in __init__
[Wed Dec 15 14:51:59.385866 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod = 
importlib.import_module(self.SETTINGS_MODULE)
[Wed Dec 15 14:51:59.385869 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
[Wed Dec 15 14:51:59.385871 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] return 
_bootstrap._gcd_import(name[level:], package, level)
[Wed Dec 15 14:51:59.385875 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 1014, in _gcd_import
[Wed Dec 15 14:51:59.385878 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 991, in _find_and_load
[Wed Dec 15 14:51:59.385882 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 961, in _find_and_load_unlocked
[Wed Dec 15 14:51:59.385886 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 219, in _call_with_frames_removed
[Wed Dec 15 14:51:59.385889 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 1014, in _gcd_import
[Wed Dec 15 14:51:59.385893 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 991, in _find_and_load
[Wed Dec 15 14:51:59.385896 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "", line 973, in _find_and_load_unlocked
[Wed Dec 15 14:51:59.385905 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] ModuleNotFoundError: No module 
named 'traveldata'
[Wed Dec 15 14:51:59.422414 2021] [authz_core:error] [pid 15536:tid 
140431673259776] [client 127.0.0.1:44656] AH01630: client denied by server 
configuration: /home/kyle/active-travel/static, referer: http://localhost/

Settings.py:
"""
Django settings for traveldata p