virtualenv (/root/eb-virt), Django-проект mediar.
Лог:
mod_wsgi (pid=27659): Target WSGI script ‘/var/www/html/xxx.com/django.wsgi’ cannot be loaded as Python module.
mod_wsgi (pid=27659): Exception occurred processing WSGI script ‘/var/www/html/xxx.com/django.wsgi’.
Traceback (most recent call last):
File “/var/www/html/xxx.com/django.wsgi”, line 9, in <module>
import django.core.handlers.wsgi
ImportError: No module named ‘django’
Методом тыка выяснила, что проблема в том, что не удается найти django, но я уже не представляю, что ещё сделать, чтобы с этим разобраться.
apache2.conf:
Mutex file:${APACHE_LOCK_DIR} default PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 5 User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} HostnameLookups Off ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf Include ports.conf <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /usr/share> AllowOverride None Require all granted </Directory> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> #<Directory /srv/> # Options Indexes FollowSymLinks # AllowOverride None # Require all granted #</Directory> AccessFileName .htaccess <FilesMatch "^\.ht"> Require all denied </FilesMatch> LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent IncludeOptional conf-enabled/*.conf IncludeOptional sites-enabled/*.conf <IfModule mpm_prefork_module> StartServers 4 MinSpareServers 20 MaxSpareServers 40 MaxClients 200 MaxRequestsPerChild 4500 </IfModule> LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so WSGIScriptAlias /var/www/html/xxx.com/public_html /var/www/html/xxx.com/public_html/mediar/mediar/wsgi.py # WSGIPythonPath /var/www/html/xxx.com/public_html:/root/eb-virt/lib/python3.4/site-packages/ WSGIDaemonProcess xxx.com python-path=/var/www/html/xxx.com/public_html: /root/eb-virt/lib/python3.4/site-packages/ # пробел между : и / специально для форума WSGIProcessGroup xxx.com <Directory /var/www/html/xxx.com/public_html/mediar/mediar/> <Files wsgi.py> Require all granted </Files> </Directory>
xxx.com.conf:
# domain: xxx.com # public: /var/www/html/xxx.com/public_html/ <VirtualHost *:80> ServerAdmin xxx@xxx.com ServerName xxx.com ServerAlias www.xxx.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/html/xxx.com/public_html # Log file locations LogLevel warn ErrorLog /var/www/html/xxx.com/log/error.log CustomLog /var/www/html/xxx.com/log/access.log combined WSGIScriptAlias / /var/www/html/django.wsgi </VirtualHost>
Злополучный django.wsgi:
#!/root/eb-virt/bin/python import os, sys sys.path.append('/root/eb-virt/lib/python3.4/site-packages/') os.environ['DJANGO_SETTINGS_MODULE'] = 'mediar.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
Решения из Гугла + ответы на похожие вопросы отсюда не помогли.
Что делать?