2017-05-13 2 views
0

나는 파이썬 3.4과 아파치에 장고를 배포하려고 이름,하지만 보내 WSGI 3.4.3 우분투 오류 500아파치 파이썬에는 모듈 오류

아파치하는 error.log :

[Sat May 13 15:56:53.638802 2017] [mpm_event:notice] [pid 3610:tid 140692947613568] AH00489: Apache/2.4.12 (Ubuntu) mod_wsgi/4.3.0 Python/3.4.3+ configured -- resuming normal operations 
[Sat May 13 15:56:53.638897 2017] [core:notice] [pid 3610:tid 140692947613568] AH00094: Command line: '/usr/sbin/apache2' 
[Sat May 13 15:56:56.622523 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] mod_wsgi (pid=3613): Target WSGI script '/var/www/html/reportado-plataforma/reportalo/wsgi.py' cannot be loaded as Python module. 
[Sat May 13 15:56:56.622610 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] mod_wsgi (pid=3613): Exception occurred processing WSGI script '/var/www/html/reportado-plataforma/reportalo/wsgi.py' 
[Sat May 13 15:56:56.622646 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] Traceback (most recent call last): 
[Sat May 13 15:56:56.622842 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] File "/var/www/html/reportado-plataforma/reportalo/wsgi.py", line 12, in <module> 
[Sat May 13 15:56:56.622851 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259]  from django.core.wsgi import get_wsgi_application 
[Sat May 13 15:56:56.622876 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] ImportError: No module named 'django' 

나는

설치

sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3

내 가상 호스트 :

WSGIScriptAlias//var/www/html/reportado-plataforma/reportalo/wsgi.py 
WSGIDaemonProcess reportalo python-path=/var/www/html/reportado-plataforma:/root/env/lib/python3.4/site-packages 
WSGIProcessGroup reportalo 
WSGIPassAuthorization On 
01 23,516,

가상 호스트 디렉토리 :

<Directory /var/www/html/reportado-plataforma/reportalo> 
    <Files wsgi.py> 
     Require all granted 
    </Files> 
</Directory> 

내 환경 :

appdirs==1.4.3 
Django==1.11.1 
django-cors-headers==2.0.2 
django-filter==1.0.2 
django-geoposition==0.3.0 
django-location-field==2.0.3 
djangorestframework==3.6.2 
djangorestframework-gis==0.11.1 
Markdown==2.6.8 
olefile==0.44 
packaging==16.8 
Pillow==4.1.1 
psycopg2==2.7.1 
pyparsing==2.2.0 
pytz==2017.2 
six==1.10.0 
uWSGI==2.0.15 

답변

2

/root 디렉토리 아래에 아무것도 볼 수있는 능력을 가지고 않을 수 있습니다 아파치가 코드를 실행하는 사용자. 일반적으로 root 만 해당 디렉토리를 볼 수 있습니다. 파이썬 가상 환경을 어딘가에 배치하십시오.

는 또한 읽기 : mod_wsgi에 함께 파이썬 가상 환경을 설정하는 권장되는 방법에 대한

. python-home을 문서화 된대로 사용하고 python-path을 사용하지 마십시오.

+0

고마워, 나는 사용자와 문제를 해결하기 위해 파이썬 - 홈에 대한 조언을 계속하겠다. –