No module named online_test
johnsmith1232541 opened this issue · 1 comments
johnsmith1232541 commented
So everything works great if I locally run it with python manage.py runserver
However, I followed the guide to set up mod_wsgi but when I tried going on the website, I received an error 500.
I checked the logs and aparently while running wsgi.py it ran into no module named online_test
[Thu Nov 05 09:03:50.123125 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] application = get_wsgi_application()
[Thu Nov 05 09:03:50.123151 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "/usr/local/lib/python3.8/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Thu Nov 05 09:03:50.123162 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] django.setup(set_prefix=False)
[Thu Nov 05 09:03:50.123178 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "/usr/local/lib/python3.8/dist-packages/django/__init__.py", line 19, in setup
[Thu Nov 05 09:03:50.123189 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Thu Nov 05 09:03:50.123205 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 76, in __getattr__
[Thu Nov 05 09:03:50.123215 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] self._setup(name)
[Thu Nov 05 09:03:50.123231 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 63, in _setup
[Thu Nov 05 09:03:50.123241 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] self._wrapped = Settings(settings_module)
[Thu Nov 05 09:03:50.123257 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 142, in __init__
[Thu Nov 05 09:03:50.123267 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] mod = importlib.import_module(self.SETTINGS_MODULE)
[Thu Nov 05 09:03:50.123311 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
[Thu Nov 05 09:03:50.123322 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] return _bootstrap._gcd_import(name[level:], package, level)
[Thu Nov 05 09:03:50.123338 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
[Thu Nov 05 09:03:50.123354 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 991, in _find_and_load
[Thu Nov 05 09:03:50.123370 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
[Thu Nov 05 09:03:50.123386 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Thu Nov 05 09:03:50.123403 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
[Thu Nov 05 09:03:50.123419 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 991, in _find_and_load
[Thu Nov 05 09:03:50.123435 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
[Thu Nov 05 09:03:50.123474 2020] [wsgi:error] [pid 55260:tid 140533665068800] [remote IP:63112] ModuleNotFoundError: No module named 'online_test'
johnsmith1232541 commented
It was a path problem. I added
sys.path.append('/path/to/project/online_test')
sys.path.append('/path/to/project/online_test/online_test')
and it worked