Mod wsgi issue regarding django apache - python
I've been stuck in this django apache deployment. When I try to deploy my web page with linode(Linux base server) and tries to access to it, my website keeps showing this 500 Internal Server error. It happens after I ran this in my venv shell.
$ sudo service apache2 restart
Since the web page suggest that I look into log file, which I did, I found I have mod wsgi issue. Here is my log file.
[Fri Feb 14 06:43:49.388284 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] mod_wsgi (pid=26679): Target WSGI script '/home/harryghgim/django_project/django_project/wsgi.py' cannot be loaded as Python module.
[Fri Feb 14 06:43:49.388369 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] mod_wsgi (pid=26679): Exception occurred processing WSGI script '/home/harryghgim/django_project/django_project/wsgi.py'.
[Fri Feb 14 06:43:49.388622 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] Traceback (most recent call last):
[Fri Feb 14 06:43:49.388720 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/django_project/wsgi.py", line 16, in <module>
[Fri Feb 14 06:43:49.388726 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] application = get_wsgi_application()
[Fri Feb 14 06:43:49.388734 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Fri Feb 14 06:43:49.388739 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] django.setup(set_prefix=False)
[Fri Feb 14 06:43:49.388745 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
[Fri Feb 14 06:43:49.388750 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Fri Feb 14 06:43:49.388757 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Fri Feb 14 06:43:49.388760 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] self._setup(name)
[Fri Feb 14 06:43:49.388766 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
[Fri Feb 14 06:43:49.388770 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] self._wrapped = Settings(settings_module)
[Fri Feb 14 06:43:49.388777 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
[Fri Feb 14 06:43:49.388781 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] mod = importlib.import_module(self.SETTINGS_MODULE)
[Fri Feb 14 06:43:49.388787 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
[Fri Feb 14 06:43:49.388790 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] return _bootstrap._gcd_import(name[level:], package, level)
[Fri Feb 14 06:43:49.388813 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Fri Feb 14 06:43:49.388820 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Fri Feb 14 06:43:49.388826 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[Fri Feb 14 06:43:49.388832 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[Fri Feb 14 06:43:49.388837 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap_external>", line 678, in exec_module
[Fri Feb 14 06:43:49.388843 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Fri Feb 14 06:43:49.388850 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/home/harryghgim/django_project/django_project/settings.py", line 17, in <module>
[Fri Feb 14 06:43:49.388853 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] config = json.load(config_file)
[Fri Feb 14 06:43:49.388859 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/__init__.py", line 299, in load
[Fri Feb 14 06:43:49.388862 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
[Fri Feb 14 06:43:49.388867 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
[Fri Feb 14 06:43:49.388871 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] return _default_decoder.decode(s)
[Fri Feb 14 06:43:49.388876 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
[Fri Feb 14 06:43:49.388879 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Fri Feb 14 06:43:49.388886 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
[Fri Feb 14 06:43:49.388889 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] obj, end = self.scan_once(s, idx)
[Fri Feb 14 06:43:49.388909 2020] [wsgi:error] [pid 26679:tid 140324755478272] [remote 121.131.97.11:51035] json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 5 column 1 (char 129)
I'm sorry for this long log file. Can anyone tell me how to fix this issue?
edit
This is my wsgi.py file at /home/harryghgim/django_project/django_project/wsgi.py
""" WSGI config for django_project project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """
import os from django.core.wsgi
import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
application = get_wsgi_application()
This is my virtual host setting at /etc/apache2/sites-available/django_project.conf
Alias /static /home/harryghgim/django_project/static
<Directory /home/harryghgim/django_project/static>
Require all granted
</Directory>
Alias /media /home/harryghgim/django_project/media
<Directory /home/harryghgim/django_project/media>
Require all granted
</Directory>
<Directory /home/harryghgim/django_project/django_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/harryghgim/django_project/django_project/wsgi.py
WSGIDaemonProcess django_app python-path=/home/harryghgim/django_project python-home=/home/harryghgim/django_project/venv
WSGIProcessGroup django_app
Should I change any of these to fix the problem?
EDITED #2
Since it's giving me huge suffering, I rather decided to run another linux server with slightly different username and server name. And greatly I have the same issue. This time I'll try to put it neat and tidy.
[Sat Feb 15 06:55:00.657722 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] mod_wsgi (pid=3546): Failed to exec Python script file '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.658894 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] mod_wsgi (pid=3546): Exception occurred processing WSGI script '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.659151 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] Traceback (most recent call last):
[Sat Feb 15 06:55:00.659254 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/django_project/wsgi.py", line 16, in <module>
[Sat Feb 15 06:55:00.659291 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] application = get_wsgi_application()
[Sat Feb 15 06:55:00.659319 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sat Feb 15 06:55:00.659324 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] django.setup(set_prefix=False)
[Sat Feb 15 06:55:00.659331 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
[Sat Feb 15 06:55:00.659335 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sat Feb 15 06:55:00.659341 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Sat Feb 15 06:55:00.659346 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] self._setup(name)
[Sat Feb 15 06:55:00.659351 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
[Sat Feb 15 06:55:00.659355 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] self._wrapped = Settings(settings_module)
[Sat Feb 15 06:55:00.659361 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
[Sat Feb 15 06:55:00.659365 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] mod = importlib.import_module(self.SETTINGS_MODULE)
[Sat Feb 15 06:55:00.659371 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Sat Feb 15 06:55:00.659375 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] return _bootstrap._gcd_import(name[level:], package, level)
[Sat Feb 15 06:55:00.659392 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Sat Feb 15 06:55:00.659398 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Sat Feb 15 06:55:00.659404 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Sat Feb 15 06:55:00.659409 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Sat Feb 15 06:55:00.659415 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Sat Feb 15 06:55:00.659420 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Sat Feb 15 06:55:00.659426 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/home/djtu/django_project/django_project/settings.py", line 17, in <module>
[Sat Feb 15 06:55:00.659430 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] config = json.load(config_file)
[Sat Feb 15 06:55:00.659435 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/__init__.py", line 296, in load
[Sat Feb 15 06:55:00.659439 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
[Sat Feb 15 06:55:00.659444 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
[Sat Feb 15 06:55:00.659448 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] return _default_decoder.decode(s)
[Sat Feb 15 06:55:00.659453 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
[Sat Feb 15 06:55:00.659457 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Sat Feb 15 06:55:00.659462 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
[Sat Feb 15 06:55:00.659466 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] obj, end = self.scan_once(s, idx)
[Sat Feb 15 06:55:00.659484 2020] [wsgi:error] [pid 3546:tid 140028878067456] [remote 121.131.97.11:50046] json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 130)
[Sat Feb 15 06:55:00.850305 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] mod_wsgi (pid=3546): Failed to exec Python script file '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.850350 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] mod_wsgi (pid=3546): Exception occurred processing WSGI script '/home/djtu/django_project/django_project/wsgi.py'.
[Sat Feb 15 06:55:00.850563 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] Traceback (most recent call last):
[Sat Feb 15 06:55:00.850634 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/django_project/wsgi.py", line 16, in <module>
[Sat Feb 15 06:55:00.850639 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] application = get_wsgi_application()
[Sat Feb 15 06:55:00.850646 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sat Feb 15 06:55:00.850663 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] django.setup(set_prefix=False)
[Sat Feb 15 06:55:00.850683 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
[Sat Feb 15 06:55:00.850687 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sat Feb 15 06:55:00.850693 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Sat Feb 15 06:55:00.850697 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] self._setup(name)
[Sat Feb 15 06:55:00.850702 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
[Sat Feb 15 06:55:00.850706 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] self._wrapped = Settings(settings_module)
[Sat Feb 15 06:55:00.850711 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
[Sat Feb 15 06:55:00.850715 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] mod = importlib.import_module(self.SETTINGS_MODULE)
[Sat Feb 15 06:55:00.850721 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Sat Feb 15 06:55:00.850724 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] return _bootstrap._gcd_import(name[level:], package, level)
[Sat Feb 15 06:55:00.850730 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Sat Feb 15 06:55:00.850735 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Sat Feb 15 06:55:00.850741 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Sat Feb 15 06:55:00.850747 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Sat Feb 15 06:55:00.850752 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Sat Feb 15 06:55:00.850758 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Sat Feb 15 06:55:00.850763 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/home/djtu/django_project/django_project/settings.py", line 17, in <module>
[Sat Feb 15 06:55:00.850767 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] config = json.load(config_file)
[Sat Feb 15 06:55:00.850772 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/__init__.py", line 296, in load
[Sat Feb 15 06:55:00.850776 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
[Sat Feb 15 06:55:00.850781 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
[Sat Feb 15 06:55:00.850785 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] return _default_decoder.decode(s)
[Sat Feb 15 06:55:00.850794 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
[Sat Feb 15 06:55:00.850798 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Sat Feb 15 06:55:00.850803 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
[Sat Feb 15 06:55:00.850807 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] obj, end = self.scan_once(s, idx)
[Sat Feb 15 06:55:00.850824 2020] [wsgi:error] [pid 3546:tid 140028760569600] [remote 121.131.97.11:50045] json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 130)
I checked project folder permission and www-data thing. Here's my code.
djtu#dj-serv:~/django_project$ ls -la
total 228
drwxr-xr-x 8 djtu www-data 4096 Feb 15 06:13 .
drwxr-xr-x 7 djtu djtu 4096 Feb 15 06:55 ..
-rw-r--r-- 1 djtu djtu 6148 Feb 15 05:56 .DS_Store
drwxr-xr-x 6 djtu djtu 4096 Feb 15 05:56 blog
-rw-rw-r-- 1 djtu www-data 167936 Feb 15 06:13 db.sqlite3
drwxr-xr-x 3 djtu djtu 4096 Feb 15 06:48 django_project
-rw-r--r-- 1 djtu djtu 634 Feb 15 05:56 manage.py
drwxrwxr-x 3 djtu www-data 4096 Feb 15 05:56 media
-rw-r--r-- 1 djtu djtu 13994 Feb 15 05:56 posts.json
-rw-r--r-- 1 djtu djtu 624 Feb 15 05:56 requirements.txt
drwxrwxr-x 4 djtu djtu 4096 Feb 15 06:08 static
drwxr-xr-x 5 djtu djtu 4096 Feb 15 05:56 users
drwxrwxr-x 6 djtu djtu 4096 Feb 15 06:00 venv
I also checked mod_wsgi was enabled. Here is the screenshot:
Just in case, I'm also putting manage.py file to see if the file is any messed up or something.
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
Also I did python manage.py check in my project folder and this is shown below.
(venv) djtu#dj-serv:~/django_project$ python manage.py check
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
self._setup(name)
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "/home/djtu/django_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/djtu/django_project/django_project/settings.py", line 17, in <module>
config = json.load(config_file)
File "/usr/lib/python3.7/json/__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 130)
Here is my machine information: Apache/2.4.41 (Ubuntu 19.10) for server and virtual host Python 3.7.5 and Django 3.0.2
I messed up with json file format. I shouldn't have put comma at the end of data. Instead this,
{"key1":"value1", "key2":"value2", "key3":"value3",}
I set as follows.
{"key1":"value1", "key2":"value2", "key3":"value3"}
And it worked beautifully.
Related
I am getting 500 Internal Server Error in django app during deloying on production server ModuleNotFoundError: No module named 'main' (wsgi:error)
I want to serve my project using mod_wsgi. When i run development server, It's started but it gives error on production server.My os is RedHat and using httpd(apache) virtual host configured with python3-mod_wsgi. This is my error [Tue Oct 05 14:01:48.998236 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] mod_wsgi (pid=423542): Failed to exec Python script file '/var/www/public_html/main/main/wsgi.py'. [Tue Oct 05 14:01:48.998291 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] mod_wsgi (pid=423542): Exception occurred processing WSGI script '/var/www/public_html/main/main/wsgi.py'. [Tue Oct 05 14:01:48.998461 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] Traceback (most recent call last): [Tue Oct 05 14:01:48.998506 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/var/www/public_html/main/main/wsgi.py", line 17, in <module> [Tue Oct 05 14:01:48.998523 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] application = get_wsgi_application() [Tue Oct 05 14:01:48.998530 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/usr/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Tue Oct 05 14:01:48.998534 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] django.setup(set_prefix=False) [Tue Oct 05 14:01:48.998540 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 19, in setup [Tue Oct 05 14:01:48.998543 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Tue Oct 05 14:01:48.998548 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__ [Tue Oct 05 14:01:48.998552 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] self._setup(name) [Tue Oct 05 14:01:48.998557 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup [Tue Oct 05 14:01:48.998560 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] self._wrapped = Settings(settings_module) [Tue Oct 05 14:01:48.998565 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__ [Tue Oct 05 14:01:48.998569 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] mod = importlib.import_module(self.SETTINGS_MODULE) [Tue Oct 05 14:01:48.998574 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module [Tue Oct 05 14:01:48.998577 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] return _bootstrap._gcd_import(name[level:], package, level) [Tue Oct 05 14:01:48.998582 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Tue Oct 05 14:01:48.998587 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Tue Oct 05 14:01:48.998592 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked [Tue Oct 05 14:01:48.998597 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed [Tue Oct 05 14:01:48.998602 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Tue Oct 05 14:01:48.998614 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Tue Oct 05 14:01:48.998619 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked [Tue Oct 05 14:01:48.998633 2021] [wsgi:error] [pid 423542:tid 140143400638208] [remote 209.141.62.185:36776] ModuleNotFoundError: No module named 'main' This is my project wsgi.py file import os import sys #from django.conf import settings from django.core.wsgi import get_wsgi_application #sys.path.append('/var/www/public_html/main/') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') application = get_wsgi_application()
I Changed my wsgi.py file to this now it's working """ WSGI config for main project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """ import os import sys from django.core.wsgi import get_wsgi_application sys.path.append('/var/www/public_html/') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') application = get_wsgi_application()
Target WSGI cannot be loaded as Python module
How to solve these errors ? Thank you very much for your help. [Sat Apr 24 06:58:37.647922 2021] [:error] [pid 1430] [remote 172.31.12.184:248] mod_wsgi (pid=1430): Target WSGI script '/opt/python/current/app/greatkart/wsgi.py' cannot be loaded as Python module. [Sat Apr 24 06:58:37.648302 2021] [:error] [pid 1430] [remote 172.31.12.184:248] File "/opt/python/current/app/greatkart/settings.py", line 120, in [Sat Apr 24 06:58:37.648305 2021] [:error] [pid 1430] [remote 172.31.12.184:248] 'HOST': os.environ['RDS_HOSTNAME'], wsgi.py import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'greatkart.settings') application = get_wsgi_application() settings.py # Database Configuration if 'RDS_DB_NAME' in os.environ: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': os.environ['RDS_DB_NAME'], 'USER': os.environ['RDS_USERNAME'], 'PASSWORD': os.environ['RDS_PASSWORD'], 'HOST': os.environ['RDS_HOSTNAME'], 'PORT': os.environ['RDS_PORT'], } } requirements.txt asgiref==3.2.10 certifi==2020.12.5 chardet==4.0.0 Django==3.1 django-admin-honeypot==1.1.0 django-admin-thumbnails==0.2.5 django-session-timeout==0.1.0 idna==2.10 Pillow==8.2.0 psycopg2-binary==2.8.6 python-decouple==3.4 pytz==2020.1 requests==2.25.1 six==1.15.0 sqlparse==0.3.1 urllib3==1.26.3 db-migrate.config container_commands: 01_migrate: command: "django-admin.py migrate" leader_only: true option_settings: aws:elasticbeanstalk:application:environment: DJANGO_SETTINGS_MODULE: greatkart.settings django.config option_settings: "aws:elasticbeanstalk:container:python": WSGIPath: "greatkart/wsgi.py" "aws:elasticbeanstalk:container:python:staticfiles": "/static/": "static/" config.yml branch-defaults: main: environment: django-env-4 group_suffix: null environment-defaults: django-env: branch: null repository: null seast-kart-env: branch: null repository: null global: application_name: django-tutorial-4 branch: null default_ec2_keyname: aws-eb default_platform: Python 3.6 default_region: us-west-2 include_git_submodules: true instance_profile: null platform_name: null platform_version: null profile: eb-cli repository: null sc: git workspace_type: Application Edit : Full Traceback [Fri Apr 23 13:21:43.405667 2021] [suexec:notice] [pid 3188] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Fri Apr 23 13:21:43.420808 2021] [http2:warn] [pid 3188] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive. [Fri Apr 23 13:21:43.420820 2021] [http2:warn] [pid 3188] AH02951: mod_ssl does not seem to be enabled [Fri Apr 23 13:21:43.421241 2021] [lbmethod_heartbeat:notice] [pid 3188] AH02282: No slotmem from mod_heartmonitor [Fri Apr 23 13:21:43.421281 2021] [:warn] [pid 3188] mod_wsgi: Compiled for Python/3.6.2. [Fri Apr 23 13:21:43.421285 2021] [:warn] [pid 3188] mod_wsgi: Runtime using Python/3.6.12. [Fri Apr 23 13:21:43.423065 2021] [mpm_prefork:notice] [pid 3188] AH00163: Apache/2.4.46 (Amazon) mod_wsgi/3.5 Python/3.6.12 configured -- resuming normal operations [Fri Apr 23 13:21:43.423081 2021] [core:notice] [pid 3188] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Fri Apr 23 13:22:18.244515 2021] [mpm_prefork:notice] [pid 3188] AH00169: caught SIGTERM, shutting down [Fri Apr 23 13:22:19.296214 2021] [suexec:notice] [pid 3418] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Fri Apr 23 13:22:19.310192 2021] [so:warn] [pid 3418] AH01574: module wsgi_module is already loaded, skipping [Fri Apr 23 13:22:19.312609 2021] [http2:warn] [pid 3418] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive. [Fri Apr 23 13:22:19.312621 2021] [http2:warn] [pid 3418] AH02951: mod_ssl does not seem to be enabled [Fri Apr 23 13:22:19.313166 2021] [lbmethod_heartbeat:notice] [pid 3418] AH02282: No slotmem from mod_heartmonitor [Fri Apr 23 13:22:19.313227 2021] [:warn] [pid 3418] mod_wsgi: Compiled for Python/3.6.2. [Fri Apr 23 13:22:19.313232 2021] [:warn] [pid 3418] mod_wsgi: Runtime using Python/3.6.12. [Fri Apr 23 13:22:19.315504 2021] [mpm_prefork:notice] [pid 3418] AH00163: Apache/2.4.46 (Amazon) mod_wsgi/3.5 Python/3.6.12 configured -- resuming normal operations [Fri Apr 23 13:22:19.315522 2021] [core:notice] [pid 3418] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Fri Apr 23 13:22:22.687415 2021] [:error] [pid 3423] [remote 127.0.0.1:0] mod_wsgi (pid=3423): Target WSGI script '/opt/python/current/app/greatkart/wsgi.py' cannot be loaded as Python module. [Fri Apr 23 13:22:22.687467 2021] [:error] [pid 3423] [remote 127.0.0.1:0] mod_wsgi (pid=3423): Exception occurred processing WSGI script '/opt/python/current/app/greatkart/wsgi.py'. [Fri Apr 23 13:22:22.688631 2021] [:error] [pid 3423] [remote 127.0.0.1:0] Traceback (most recent call last): [Fri Apr 23 13:22:22.688694 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/current/app/greatkart/wsgi.py", line 16, in <module> [Fri Apr 23 13:22:22.688699 2021] [:error] [pid 3423] [remote 127.0.0.1:0] application = get_wsgi_application() [Fri Apr 23 13:22:22.688706 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Fri Apr 23 13:22:22.688710 2021] [:error] [pid 3423] [remote 127.0.0.1:0] django.setup(set_prefix=False) [Fri Apr 23 13:22:22.688715 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 19, in setup [Fri Apr 23 13:22:22.688719 2021] [:error] [pid 3423] [remote 127.0.0.1:0] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Fri Apr 23 13:22:22.688725 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 83, in __getattr__ [Fri Apr 23 13:22:22.688733 2021] [:error] [pid 3423] [remote 127.0.0.1:0] self._setup(name) [Fri Apr 23 13:22:22.688740 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 70, in _setup [Fri Apr 23 13:22:22.688743 2021] [:error] [pid 3423] [remote 127.0.0.1:0] self._wrapped = Settings(settings_module) [Fri Apr 23 13:22:22.688748 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 177, in __init__ [Fri Apr 23 13:22:22.688752 2021] [:error] [pid 3423] [remote 127.0.0.1:0] mod = importlib.import_module(self.SETTINGS_MODULE) [Fri Apr 23 13:22:22.688757 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line 126, in import_module [Fri Apr 23 13:22:22.688760 2021] [:error] [pid 3423] [remote 127.0.0.1:0] return _bootstrap._gcd_import(name[level:], package, level) [Fri Apr 23 13:22:22.688765 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Fri Apr 23 13:22:22.688770 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Fri Apr 23 13:22:22.688775 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked [Fri Apr 23 13:22:22.688781 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked [Fri Apr 23 13:22:22.688786 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap_external>", line 674, in exec_module [Fri Apr 23 13:22:22.688791 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap_external>", line 781, in get_code [Fri Apr 23 13:22:22.688796 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap_external>", line 741, in source_to_code [Fri Apr 23 13:22:22.688801 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed [Fri Apr 23 13:22:22.688815 2021] [:error] [pid 3423] [remote 127.0.0.1:0] File "/opt/python/current/app/greatkart/settings.py", line 33 [Fri Apr 23 13:22:22.688824 2021] [:error] [pid 3423] [remote 127.0.0.1:0] \xc2\xb2 [Fri Apr 23 13:22:22.688838 2021] [:error] [pid 3423] [remote 127.0.0.1:0] ^ [Fri Apr 23 13:22:22.688845 2021] [:error] [pid 3423] [remote 127.0.0.1:0] SyntaxError: invalid character in identifier [Fri Apr 23 13:22:23.691877 2021] [:error] [pid 3423] [remote 127.0.0.1:40] mod_wsgi (pid=3423): Target WSGI script '/opt/python/current/app/greatkart/wsgi.py' cannot be loaded as Python module. [Fri Apr 23 13:22:23.691926 2021] [:error] [pid 3423] [remote 127.0.0.1:40] mod_wsgi (pid=3423): Exception occurred processing WSGI script '/opt/python/current/app/greatkart/wsgi.py'. [Fri Apr 23 13:22:23.692096 2021] [:error] [pid 3423] [remote 127.0.0.1:40] Traceback (most recent call last): [Fri Apr 23 13:22:23.692152 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/current/app/greatkart/wsgi.py", line 16, in <module> [Fri Apr 23 13:22:23.692157 2021] [:error] [pid 3423] [remote 127.0.0.1:40] application = get_wsgi_application() [Fri Apr 23 13:22:23.692163 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Fri Apr 23 13:22:23.692167 2021] [:error] [pid 3423] [remote 127.0.0.1:40] django.setup(set_prefix=False) [Fri Apr 23 13:22:23.692172 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 19, in setup [Fri Apr 23 13:22:23.692176 2021] [:error] [pid 3423] [remote 127.0.0.1:40] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Fri Apr 23 13:22:23.692181 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 83, in __getattr__ [Fri Apr 23 13:22:23.692193 2021] [:error] [pid 3423] [remote 127.0.0.1:40] self._setup(name) [Fri Apr 23 13:22:23.692199 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 70, in _setup [Fri Apr 23 13:22:23.692202 2021] [:error] [pid 3423] [remote 127.0.0.1:40] self._wrapped = Settings(settings_module) [Fri Apr 23 13:22:23.692207 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 177, in __init__ [Fri Apr 23 13:22:23.692211 2021] [:error] [pid 3423] [remote 127.0.0.1:40] mod = importlib.import_module(self.SETTINGS_MODULE) [Fri Apr 23 13:22:23.692216 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line 126, in import_module [Fri Apr 23 13:22:23.692219 2021] [:error] [pid 3423] [remote 127.0.0.1:40] return _bootstrap._gcd_import(name[level:], package, level) [Fri Apr 23 13:22:23.692224 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Fri Apr 23 13:22:23.692229 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Fri Apr 23 13:22:23.692234 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked [Fri Apr 23 13:22:23.692239 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked [Fri Apr 23 13:22:23.692244 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap_external>", line 674, in exec_module [Fri Apr 23 13:22:23.692249 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap_external>", line 781, in get_code [Fri Apr 23 13:22:23.692259 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap_external>", line 741, in source_to_code [Fri Apr 23 13:22:23.692264 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed [Fri Apr 23 13:22:23.692278 2021] [:error] [pid 3423] [remote 127.0.0.1:40] File "/opt/python/current/app/greatkart/settings.py", line 33 [Fri Apr 23 13:22:23.692288 2021] [:error] [pid 3423] [remote 127.0.0.1:40] \xc2\xb2 [Fri Apr 23 13:22:23.692304 2021] [:error] [pid 3423] [remote 127.0.0.1:40] ^ [Fri Apr 23 13:22:23.692311 2021] [:error] [pid 3423] [remote 127.0.0.1:40] SyntaxError: invalid character in identifier [Fri Apr 23 13:22:24.695493 2021] [:error] [pid 3423] [remote 127.0.0.1:40] mod_wsgi (pid=3423): Target WSGI script '/opt/python/current/app/greatkart/wsgi.py' cannot be loaded as Python module. Edit 2 Database config : Database config in AWS EB
Target WSGI script '/opt/python/current/app/github/wsgi.py' cannot be loaded as Python module
I am trying for two days to deploy my django project on aws. But i am getting one error after another. After lots of searching for answers. This is the last error that i am not able to overcome. I am following these guides: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html https://www.1strategy.com/blog/2017/05/23/tutorial-django-elastic-beanstalk/ After all of it. When i try to access my site.It shows 500 Server Error. In Logs it Shows Target WSGI script '/opt/python/current/app/github/wsgi.py' cannot be loaded as Python module. Another question on net answered to comment the Database lines in settings file. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } This is my wsgi.py file import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') application = get_wsgi_application() After it my site loads. But then the problem is there is not database. So it throws another error settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details. So now i am struck here. I have looked at every related question tried there solution but nothing is working. It is my first time trying AWS and it is turning out to be very hard. I deployed my project on heroku successfully but heroku does not support cron job and i really need something like cron job for my project. This is my django.config in .ebextensions folder option_settings: "aws:elasticbeanstalk:application:environment": DJANGO_SETTINGS_MODULE: "github.settings" PYTHONPATH: "$PYTHONPATH" "aws:elasticbeanstalk:container:python": WSGIPath: "github/wsgi.py" StaticFiles: "/static/=www/static/" packages: yum: postgresql95-devel: [] After changing to WSGIPath: github.wsgi:application The error stays the same as 500 internal error but error in log changes so. [Fri Sep 18 19:50:46.625700 2020] [:error] [pid 6504] [remote 127.0.0.1:0] application = get_wsgi_application() [Fri Sep 18 19:50:46.625707 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Fri Sep 18 19:50:46.625711 2020] [:error] [pid 6504] [remote 127.0.0.1:0] django.setup(set_prefix=False) [Fri Sep 18 19:50:46.625721 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup [Fri Sep 18 19:50:46.625725 2020] [:error] [pid 6504] [remote 127.0.0.1:0] apps.populate(settings.INSTALLED_APPS) [Fri Sep 18 19:50:46.625730 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate [Fri Sep 18 19:50:46.625734 2020] [:error] [pid 6504] [remote 127.0.0.1:0] app_config.import_models() [Fri Sep 18 19:50:46.625740 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models [Fri Sep 18 19:50:46.625743 2020] [:error] [pid 6504] [remote 127.0.0.1:0] self.models_module = import_module(models_module_name) [Fri Sep 18 19:50:46.625749 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line 126, in import_module [Fri Sep 18 19:50:46.625753 2020] [:error] [pid 6504] [remote 127.0.0.1:0] return _bootstrap._gcd_import(name[level:], package, level) [Fri Sep 18 19:50:46.625758 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Fri Sep 18 19:50:46.625776 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Fri Sep 18 19:50:46.625782 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked 665, in _load_unlocked [Fri Sep 18 19:50:46.625816 2020] [:error] [pid 6504] [remote 127.0.0.1:0] class AbstractBaseUser(models.Model): [Fri Sep 18 19:50:46.625832 2020] [:error] [pid 6504] [remote 127.0.0.1:0] value.contribute_to_class(cls, name) [Fri Sep 18 19:50:46.625838 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/models/options.py", line 206, in contribute_to_class-- More --[Fri Sep 18 19:50:46.625859 2020] [:error] [pid 6504] [remote 127.0.0.1:0] backend = load_backend(db['ENGINE']) [Fri Sep 18 19:50:46.625884 2020] [:error] [pid 6504] [remote 127.0.0.1:0] check_sqlite_version() [Fri Sep 18 19:50:46.625889 2020] [:error] [pid 6504] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 67, in check_sqlite_version-- M[Fri Sep 18 19:50:47.629796 2020] [:error] [pid 6504] [remote 127.0.0.1:28] Traceback (most recent call last): [Fri Sep 18 19:50:47.629840 2020] [:error] [pid 6504] [remote 127.0.0.1:28] application = get_wsgi_application() [Fri Sep 18 19:50:47.629850 2020] [:error] [pid 6504] [remote 127.0.0.1:28] django.setup(set_prefix=False) [Fri Sep 18 19:50:47.629860 2020] [:error] [pid 6504] [remote 127.0.0.1:28] apps.populate(settings.INSTALLED_APPS) [Fri Sep 18 19:50:47.629884 2020] [:error] [pid 6504] [remote 127.0.0.1:28] RuntimeError: populate() isn't reentrant [Fri Sep 18 19:50:48.633315 2020] [:error] [pid 6504] [remote 127.0.0.1:28] Traceback (most recent call last): [Fri Sep 18 19:50:48.633351 2020] [:error] [pid 6504] [remote 127.0.0.1:28] application = get_wsgi_application() [Fri Sep 18 19:50:48.633362 2020] [:error] [pid 6504] [remote 127.0.0.1:28] django.setup(set_prefix=False) [Fri Sep 18 19:50:48.633372 2020] [:error] [pid 6504] [remote 127.0.0.1:28] apps.populate(settings.INSTALLED_APPS) [Fri Sep 18 19:50:48.633396 2020] [:error] [pid 6504] [remote 127.0.0.1:28] RuntimeError: populate() isn't reentrant [Fri Sep 18 19:50:49.638585 2020] [:error] [pid 6504] [remote 127.0.0.1:32] Traceback (most recent call last): [Fri Sep 18 19:50:49.638628 2020] [:error] [pid 6504] [remote 127.0.0.1:32] application = get_wsgi_application() [Fri Sep 18 19:50:49.638638 2020] [:error] [pid 6504] [remote 127.0.0.1:32] django.setup(set_prefix=False) [Fri Sep 18 19:50:49.638647 2020] [:error] [pid 6504] [remote 127.0.0.1:32] apps.populate(settings.INSTALLED_APPS) [Fri Sep 18 19:50:49.638672 2020] [:error] [pid 6504] [remote 127.0.0.1:32] RuntimeError: populate() isn't reentrant [Fri Sep 18 19:51:21.223059 2020] [:error] [pid 6504] [remote 172.31.2.91:32] Traceback (most recent call last): [Fri Sep 18 19:51:21.223107 2020] [:error] [pid 6504] [remote 172.31.2.91:32] application = get_wsgi_application() [Fri Sep 18 19:51:21.223118 2020] [:error] [pid 6504] [remote 172.31.2.91:32] django.setup(set_prefix=False) [Fri Sep 18 19:51:21.223154 2020] [:error] [pid 6504] [remote 172.31.2.91:32] RuntimeError: populate() isn't reentrant [Fri Sep 18 19:51:22.482909 2020] [:error] [pid 6504] [remote 172.31.2.91:32] Traceback (most recent call last): [Fri Sep 18 19:51:22.482955 2020] [:error] [pid 6504] [remote 172.31.2.91:32] application = get_wsgi_application() [Fri Sep 18 19:51:22.482966 2020] [:error] [pid 6504] [remote 172.31.2.91:32] django.setup(set_prefix=False) [Fri Sep 18 19:51:22.483001 2020] [:error] [pid 6504] [remote 172.31.2.91:32] RuntimeError: populate() isn't reentrant
Apache/mod_wsgi ModuleNotFoundError
I am trying to host a Django website on an Ubuntu VPS with Apache/mod_wsgi. If I run it in embedded mode, the site loads. WSGIScriptAlias / /home/admin/web/mywebsite/myproject/wsgi.py WSGIPythonHome /home/admin/web/mywebsite/venv WSGIPythonPath /home/admin/web/mywebsite <Directory /home/admin/web/mywebsite/myproject> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> However, if I try to run it in daemon mode, I get an error: ModuleNotFoundError: No module named 'myproject'. WSGIDaemonProcess myproject python-home=/home/admin/web/mywebsite/venv python-path=/home/admin/web/mywebsite socket-user=#1001 WSGIProcessGroup myproject WSGIScriptAlias / /home/admin/web/mywebsite/myproject/wsgi.py My WSGI file: import os from django.core.wsgi import get_wsgi_application os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' application = get_wsgi_application() If I run a manage.py command, it shows the same ModuleNotFoundError error in both embedded and daemon mode. What could possibly be wrong? [Mon Feb 24 09:00:37.333725 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] mod_wsgi (pid=7830): Target WSGI script '/home/admin/web/mywebsite/myproject/wsgi.py' cannot be loaded as Python module. [Mon Feb 24 09:00:37.333768 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] mod_wsgi (pid=7830): Exception occurred processing WSGI script '/home/admin/web/mywebsite/myproject/wsgi.py'. [Mon Feb 24 09:00:37.334090 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] Traceback (most recent call last): [Mon Feb 24 09:00:37.334124 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/home/admin/web/mywebsite/myproject/wsgi.py", line 16, in <module> [Mon Feb 24 09:00:37.334127 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] application = get_wsgi_application() [Mon Feb 24 09:00:37.334131 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/home/admin/web/mywebsite/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Mon Feb 24 09:00:37.334133 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] django.setup(set_prefix=False) [Mon Feb 24 09:00:37.334136 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/home/admin/web/mywebsite/venv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup [Mon Feb 24 09:00:37.334139 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Mon Feb 24 09:00:37.334142 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/home/admin/web/mywebsite/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__ [Mon Feb 24 09:00:37.334144 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] self._setup(name) [Mon Feb 24 09:00:37.334147 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/home/admin/web/mywebsite/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup [Mon Feb 24 09:00:37.334149 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] self._wrapped = Settings(settings_module) [Mon Feb 24 09:00:37.334152 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/home/admin/web/mywebsite/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__ [Mon Feb 24 09:00:37.334154 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] mod = importlib.import_module(self.SETTINGS_MODULE) [Mon Feb 24 09:00:37.334157 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module [Mon Feb 24 09:00:37.334159 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] return _bootstrap._gcd_import(name[level:], package, level) [Mon Feb 24 09:00:37.334162 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Mon Feb 24 09:00:37.334165 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Mon Feb 24 09:00:37.334169 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked [Mon Feb 24 09:00:37.334172 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed [Mon Feb 24 09:00:37.334175 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Mon Feb 24 09:00:37.334178 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Mon Feb 24 09:00:37.334188 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked [Mon Feb 24 09:00:37.334197 2020] [wsgi:error] [pid 7830] [remote 5.187.171.36:18335] ModuleNotFoundError: No module named 'myproject'
Problems Configuring mod_wsgi with Virtual Env
I am struggling trying to get Apache 2.4.7 to serve a Django 1.8.17 application using mod_wsgi 4.5.15 with Python 3.5.3 as a virtual environment. This is the only virtual environment I have on the machine (Linux Mint 17.3). I am getting an "internal Server Error" in the browser. My Apache error log says: [Thu Apr 06 19:48:22.530935 2017] [mpm_prefork:notice] [pid 4476] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.21 mod_wsgi/4.5.15 Python/3.5 configured -- resuming normal operations [Thu Apr 06 19:48:22.531008 2017] [core:notice] [pid 4476] AH00094: Command line: '/usr/sbin/apache2' [Thu Apr 06 19:48:28.165360 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] mod_wsgi (pid=4480): Target WSGI script '/home/magic-rat/ektropy_project/ektropy_project/wsgi.py' cannot be loaded as Python module. [Thu Apr 06 19:48:28.165494 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] mod_wsgi (pid=4480): Exception occurred processing WSGI script '/home/magic-rat/ektropy_project/ektropy_project/wsgi.py'. [Thu Apr 06 19:48:28.166150 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] Traceback (most recent call last): [Thu Apr 06 19:48:28.166210 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/home/magic-rat/ektropy_project/ektropy_project/wsgi.py", line 16, in <module> [Thu Apr 06 19:48:28.166218 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] application = get_wsgi_application() [Thu Apr 06 19:48:28.166230 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/home/magic-rat/virtualenvs/ektropy_project/lib/python3.5/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application [Thu Apr 06 19:48:28.166238 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] django.setup() [Thu Apr 06 19:48:28.166250 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/home/magic-rat/virtualenvs/ektropy_project/lib/python3.5/site-packages/django/__init__.py", line 17, in setup [Thu Apr 06 19:48:28.166257 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Thu Apr 06 19:48:28.166269 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/home/magic-rat/virtualenvs/ektropy_project/lib/python3.5/site-packages/django/conf/__init__.py", line 48, in __getattr__ [Thu Apr 06 19:48:28.166276 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] self._setup(name) [Thu Apr 06 19:48:28.166288 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/home/magic-rat/virtualenvs/ektropy_project/lib/python3.5/site-packages/django/conf/__init__.py", line 44, in _setup [Thu Apr 06 19:48:28.166295 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] self._wrapped = Settings(settings_module) [Thu Apr 06 19:48:28.166307 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/home/magic-rat/virtualenvs/ektropy_project/lib/python3.5/site-packages/django/conf/__init__.py", line 92, in __init__ [Thu Apr 06 19:48:28.166314 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] mod = importlib.import_module(self.SETTINGS_MODULE) [Thu Apr 06 19:48:28.166325 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "/usr/local/lib/python3.5/importlib/__init__.py", line 126, in import_module [Thu Apr 06 19:48:28.166335 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] return _bootstrap._gcd_import(name[level:], package, level) [Thu Apr 06 19:48:28.166347 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 986, in _gcd_import [Thu Apr 06 19:48:28.166358 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 969, in _find_and_load [Thu Apr 06 19:48:28.166369 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked [Thu Apr 06 19:48:28.166381 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed [Thu Apr 06 19:48:28.166392 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 986, in _gcd_import [Thu Apr 06 19:48:28.166418 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 969, in _find_and_load [Thu Apr 06 19:48:28.166429 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked [Thu Apr 06 19:48:28.166464 2017] [wsgi:error] [pid 4480] [remote 127.0.0.1:34901] ImportError: No module named 'ektropy_project' My directory structure is: home/magic-rat/ | |__________virtualenvs | | | |-ektropy_project | | | |-lib | | | |-python3.5 | | | |-site_packages | |__________ektropy_project | |-manage.py | |-ektropy_project | |-wsgi.py |-helloworld.wsgi (so you can see where it is) My Apache Virtual host file is: <VirtualHost *:8000> ServerAdmin webmaster#localhost DocumentRoot /var/www/html WSGIDaemonProcess ektropy_project python-home=/home/magic-rat/virtualenvs/ektropy_project WSGIProcessGroup ektropy_project WSGIApplicationGroup %{GLOBAL} WSGIScriptAlias / /home/magic-rat/ektropy_project/ektropy_project/wsgi.py <Directory /home/magic-rat/ektropy_project/ektropy_project> <Files wsgi.py> Require all granted </Files> </Directory> My wsgi.py file is: import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ektropy_project.settings") application = get_wsgi_application() I believe mod_wsgi is configured properly. I can run a simple hello_world program and it works. I believe permissions are set properly on all the files. Any help is appreciated.
Add an extra option to WSGIDaemonProcess of: python-path=/home/magic-rat/ektropy_project You have to tell mod_wsgi where your project code is as well so it can import it.