У меня установлен сервер инстансов ВМ с Apache2, mod_wsgi и Django. На сервере установлен python, который поставляется вместе с сервером Ubuntu.
Я использую веб-приложение Django, развернутое на сервере Apache с WSGI, и все идет гладко. Но я активирую свой virtualEnv в Сервере для некоторой работы и затем деактивировал Среду. И с тех пор я получаю следующую ошибку.
Мой wsgi.py
import os
import sys
import time
import traceback
import signal
from django.core.wsgi import get_wsgi_application
sys.path.append('/var/www/WFH_project/wfhProject')
sys.path.append('/var/www/WFH_project/myDjangoEnv/lib/python3.6/site-packages/')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wfhProject.settings')
#application = get_wsgi_application()
try:
application = get_wsgi_application()
except Exception:
# Error loading applications
if 'mod_wsgi' in sys.modules:
traceback.print_exc()
os.kill(os.getpid(), signal.SIGINT)
time.sleep(2.5)
Мой домен.conf / etc / apache2 / sites-available / weeffective.com.conf
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
Alias /static /var/www/WFH_project/wfhProject/static/
<Directory /var/www/WFH_project/wfhProject/>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/WFH_project/wfhProject/wfhProject/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess wfh_Project python-path=/var/www/WFH_project/wfhProject python-home=/var/www/WFH_project/myDjangoEnv
WSGIProcessGroup wfh_Project
WSGIScriptAlias / /var/www/WFH_project/wfhProject/wfhProject/wsgi.py
DocumentRoot /var/www/WFH_project/wfhProject/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.com [OR]
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Журнал ошибок: tail -f /var/log/apache2/error.log
[Thu Apr 23 06:05:20.562061 2020] [wsgi:error] [pid 8086:tid 140529725409024] File "/var/www/WFH_project/myDjangoEnv/lib/python3.6/site-packages/admin_interface/settings.py", line 27, in check_installed_apps
[Thu Apr 23 06:05:20.562066 2020] [wsgi:error] [pid 8086:tid 140529725409024] check_installed_app('flat', (1, 9))
[Thu Apr 23 06:05:20.562071 2020] [wsgi:error] [pid 8086:tid 140529725409024] File "/var/www/WFH_project/myDjangoEnv/lib/python3.6/site-packages/admin_interface/settings.py", line 22, in check_installed_app
[Thu Apr 23 06:05:20.562074 2020] [wsgi:error] [pid 8086:tid 140529725409024] app, *app_dj_version_limit))
[Thu Apr 23 06:05:20.562090 2020] [wsgi:error] [pid 8086:tid 140529725409024] django.core.exceptions.ImproperlyConfigured: 'flat' not needed since django 1.9, remove it from settings.INSTALLED_APPS.
[Thu Apr 23 06:05:23.065811 2020] [wsgi:error] [pid 8086:tid 140529725409024] [remote 103.216.171.76:27672] mod_wsgi (pid=8086): Target WSGI script '/var/www/WFH_project/wfhProject/wfhProject/wsgi.py' does not contain WSGI application 'application'.
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=False debug=False>>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/base_events.py", line 526, in __del__
NameError: name 'ResourceWarning' is not defined