В процессе изучения Django столкнулся с ошибкой No module named 'django'. Сам модуль устанавливал, сносил и еще раз устанавливал, но проблема остается.
'<pre>
<code>
[Tue May 24 08:07:49.610921 2016] [:error] [pid 14934:tid 140038703113984] [client 85.212.24.101:62664] mod_wsgi (pid=14934): Target WSGI script '/var/www/s052d78fe.fastvps-server.com/public_html/msite/msite/apache/wsgi.py' cannot be loaded as Python module.
[Tue May 24 08:07:49.611030 2016] [:error] [pid 14934:tid 140038703113984] [client 85.212.24.101:62664] mod_wsgi (pid=14934): Exception occurred processing WSGI script '/var/www/s052d78fe.fastvps-server.com/public_html/msite/msite/apache/wsgi.py'.
[Tue May 24 08:07:49.611098 2016] [:error] [pid 14934:tid 140038703113984] [client 85.212.24.101:62664] Traceback (most recent call last):
[Tue May 24 08:07:49.611196 2016] [:error] [pid 14934:tid 140038703113984] [client 85.212.24.101:62664] File "/var/www/s052d78fe.fastvps-server.com/public_html/msite/msite/apache/wsgi.py", line 7, in <module>
[Tue May 24 08:07:49.611210 2016] [:error] [pid 14934:tid 140038703113984] [client 85.212.24.101:62664] from django.core.wsgi import get_wsgi_application
[Tue May 24 08:07:49.611259 2016] [:error] [pid 14934:tid 140038703113984] [client 85.212.24.101:62664] ImportError: No module named 'django'
[Tue May 24 08:07:50.884493 2016] [:error] [pid 14934:tid 140038616643328] [client 85.212.24.101:62665] mod_wsgi (pid=14934): Target WSGI script '/var/www/s052d78fe.fastvps-server.com/public_html/msite/msite/apache/wsgi.py' cannot be loaded as Python module., referer: http://s052d78fe.fastvps-server.com/
[Tue May 24 08:07:50.884604 2016] [:error] [pid 14934:tid 140038616643328] [client 85.212.24.101:62665] mod_wsgi (pid=14934): Exception occurred processing WSGI script '/var/www/s052d78fe.fastvps-server.com/public_html/msite/msite/apache/wsgi.py'., referer: http://s052d78fe.fastvps-server.com/
[Tue May 24 08:07:50.884699 2016] [:error] [pid 14934:tid 140038616643328] [client 85.212.24.101:62665] Traceback (most recent call last):, referer: http://s052d78fe.fastvps-server.com/
[Tue May 24 08:07:50.884813 2016] [:error] [pid 14934:tid 140038616643328] [client 85.212.24.101:62665] File "/var/www/s052d78fe.fastvps-server.com/public_html/msite/msite/apache/wsgi.py", line 7, in <module>, referer: http://s052d78fe.fastvps-server.com/
[Tue May 24 08:07:50.884829 2016] [:error] [pid 14934:tid 140038616643328] [client 85.212.24.101:62665] from django.core.wsgi import get_wsgi_application, referer: http://s052d78fe.fastvps-server.com/
[Tue May 24 08:07:50.884886 2016] [:error] [pid 14934:tid 140038616643328] [client 85.212.24.101:62665] ImportError: No module named 'django
</code></pre>'
wsgi.py файл
<pre><code>
wsgi.py
import os
import time
import traceback
import signal
import sys
from django.core.wsgi import get_wsgi_application
Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(file)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
sys.path.append(project)
Add the path to 3rd party django application and to django itself.
sys.path.append('/var/www/s052d78fe.fastvps-server.com/public_html/myv/lib/python3.4')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.apache.override'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
</code></pre>
sys.path:
<pre><code>
['', '/var/www/s052d78fe.fastvps-server.com/public_html/myv/lib/python3.4',
'/var/www/s052d78fe.fastvps-server.com/public_html/myv/lib/python3.4/plat-x86_64-linux-gnu',
'/var/www/s052d78fe.fastvps-server.com/public_html/myv/lib/python3.4/lib-dynload',
'/usr/lib/python3.4',
'/usr/lib/python3.4/plat-x86_64-linux-gnu',
'/var/www/s052d78fe.fastvps-server.com/public_html/myv/lib/python3.4/site-packages']
</code></pre>
Updated 24 May 2016, 15:39 by brogin_77.