Я пытаюсь настроить свой первый Django проект, и у меня есть некоторые проблемы с интеграцией Apache.
Здесь мое дерево файлов
venv-django
aci_project/
|_manage.py
|_aci_project/
| |_ __init__.py
| |_settings.py
| |_ urls.py
| |_ asgi.py
| |_ wsgi.py
|
|_aci_api/
|_ __init__.py
|_aci_script
|_admin.py
|_apps.py
|_migrations/
| |_ __init__.py
|_static --> css
|_templates --> template html
|_tests.py
|_urls.py
|_views.py
По сути, поток выглядит следующим образом:
Браузер -> aci_project -> urls.py -> aci_api -> views.py -> вызов скриптов в aci_script
Если я запускаю команду " python manage.py runserver "работает нормально.
Сейчас я пытаюсь интегрировать мой Django проект с Apache, но он не работает.
Это мой файл vhost в Apache:
<VirtualHost *:8000>
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combine
<Directory /var/opt/aci_project/aci_project/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIApplicationGroup aciweb01t.stluc.ucl.ac.be
WSGIDaemonProcess aciweb01t.stluc.ucl.ac.be group=www-data python-path=/var/opt/aci_project
WSGIProcessGroup aciweb01t.stluc.ucl.ac.be
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /var/opt/aci_project/aci_project/wsgi.py
</VirtualHost>
здесь мой файл wsgi.py в aci_project -> manage.py -> _aci_project
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'aci_project.settings')
application = get_wsgi_application()
И это ошибка, которую я имею в apache журналы:
[Wed Apr 22 16:49:12.468252 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] mod_wsgi (pid=7818): Failed to exec Python script file '/var/opt/aci_project/aci_project/wsgi.py'.
[Wed Apr 22 16:49:12.468453 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] mod_wsgi (pid=7818): Exception occurred processing WSGI script '/var/opt/aci_project/aci_project/wsgi.py'.
[Wed Apr 22 16:49:12.468926 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] Traceback (most recent call last):
[Wed Apr 22 16:49:12.469073 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/var/opt/aci_project/aci_project/wsgi.py", line 16, in <module>
[Wed Apr 22 16:49:12.469092 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] application = get_wsgi_application()
[Wed Apr 22 16:49:12.469109 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/var/opt/venv-django/lib64/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Apr 22 16:49:12.469118 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] django.setup(set_prefix=False)
[Wed Apr 22 16:49:12.469132 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/var/opt/venv-django/lib64/python3.6/site-packages/django/__init__.py", line 19, in setup
[Wed Apr 22 16:49:12.469140 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Wed Apr 22 16:49:12.469153 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/var/opt/venv-django/lib64/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
[Wed Apr 22 16:49:12.469162 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] self._setup(name)
[Wed Apr 22 16:49:12.469175 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/var/opt/venv-django/lib64/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
[Wed Apr 22 16:49:12.469183 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] self._wrapped = Settings(settings_module)
[Wed Apr 22 16:49:12.469196 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/var/opt/venv-django/lib64/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
[Wed Apr 22 16:49:12.469204 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] mod = importlib.import_module(self.SETTINGS_MODULE)
[Wed Apr 22 16:49:12.469234 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
[Wed Apr 22 16:49:12.469245 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Apr 22 16:49:12.469259 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Wed Apr 22 16:49:12.469272 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Wed Apr 22 16:49:12.469285 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
[Wed Apr 22 16:49:12.469298 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Wed Apr 22 16:49:12.469323 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Wed Apr 22 16:49:12.469337 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Wed Apr 22 16:49:12.469350 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
[Wed Apr 22 16:49:12.469412 2020] [wsgi:error] [pid 7818:tid 140205314995968] [remote 10.195.113.74:28031] ModuleNotFoundError: No module named 'aci_project'
Большое спасибо за вашу помощь!