2013-02-16 2 views
-1

저는 장고를 로컬로 사용하고 있으며 현재 실행중인 Ubuntu 서버의 프로덕션 Apache 환경에 일부 코드를 푸시하려고합니다 (http://www.youtube.com/watch?v=hBMVVruB9Vs).Django + Apache - wsgi trouble

그러나 디렉토리의 파일 목록 만 얻었습니다. 우선 파이썬이 터미널에서 파이썬 명령을 실행하여 설치되도록했습니다.

나는 다음과 같은 명령을 apaache 및 모드 WSGI를 설치 한 :

는 sudo apt-get을 아파치를 설치 는 sudo apt-get을

내가 있는지 테스트 한 libapache2 - 모드 - WSGI 설치 사용하도록 설정되었습니다. 여기

import os 
import sys 
sys.path.append('/var/www/firstweb') 
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings' 

import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

내 firstweb.conf 파일입니다 :

<VirtualHost *:80> 

WSGIScriptAlias//firstweb.wsgi 

Alias /static /var/www/firstweb/static 

<Directory /var/www/firstweb/> 
Order allow,deny 
Allow from all 
</Directory> 

</VirtualHost> 

내 장고 프로젝트에 있습니다 여기에

루트에 위치한 내 WSGI 파일 firstweb.wsgi입니다/var에/www/firstweb/

정직하게도 비디오가 정상적으로 돌아가고 있습니다. - 단지 디렉토리 태그를 변경하고 문제가 해결되지 않으면

<Directory /var/www/firstweb/static> 
    Order allow,deny 
    Option Indexes 
    Allow from all 
    </Directory> 

    WSGIScriptAlias//full-system-path-to/firstweb/wsgi.py 

을 :

[Sat Feb 16 16:19:31 2013] [notice] Apache/2.2.22 (Ubuntu) configured -- resuming normal operations 
[Sat Feb 16 16:20:46 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 16:20:47 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 16:20:47 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 16:20:47 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
[Sat Feb 16 16:37:05 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 16:37:06 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 16:37:06 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 16:37:06 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
[Sat Feb 16 16:37:17 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:20 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:25 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:25 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:37:26 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:38:01 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:39:19 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 16:39:20 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 16:39:20 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 16:39:20 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
[Sat Feb 16 16:39:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:39:42 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:48:00 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:48:02 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:49:51 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 16:49:52 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 16:49:52 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 16:49:52 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
[Sat Feb 16 16:49:55 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:49:56 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:49:58 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico 
[Sat Feb 16 16:53:21 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 16:53:22 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 16:53:22 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 16:53:22 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
[Sat Feb 16 16:55:34 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 16:55:35 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 16:55:35 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 16:55:35 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
[Sat Feb 16 17:00:07 2013] [notice] caught SIGTERM, shutting down 
[Sat Feb 16 17:00:08 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. 
[Sat Feb 16 17:00:08 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. 
[Sat Feb 16 17:00:08 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations 
+0

당신은 아파치 로그를 볼 수 있습니까?/var/logs/httpd 또는/var/logs/apache 아래에 있어야합니다. –

+0

/var/log/apache2/파일을 보았습니다. 오류 로그를 체크 아웃, 난 아무것도 파이썬 버전 불일치 이외에 보이지 않는 : – user2078888

+0

어쨌든 우리를 보여줍니다 - 또한 어떤 화면 때 당신이 테스트를 얻을 - 어떻게 생겼어?무엇이 그것에 대해 작동하지 않습니다 –

답변

0

과 같이 당신의 가상 호스트를 구성하십시오 : :(

편집, 여기에 오류 로그입니다 위와 같이 정적을 추가하십시오. 정적을 추가하지 않으면 디렉토리에 파일이 표시됩니다.

+0

을 통해 사용 설정하지 마십시오. 옵션 색인에 대한 오류가 발생하여 제거했습니다. 나는 또한 내 전체 프로젝트를 웹 디렉토리에서 홈 디렉토리 (/ home/우분투/firstweb)로 옮겼다. 결과를 얻지 않고 여러 가지 방법으로 모든 것을 다시 작성하려고 시도했다. www 폴더에서 firstweb 디렉토리도 제거했습니다. 나는 일반 색인 페이지 외에 wsgi/apache에서 아무것도 얻지 못한다. – user2078888

0

다음과 같이 가상 호스트를 구성하십시오.

앱 경로

-

<VirtualHost *:80> 
ServerName mysite.com 
ServerAlias www.mysite.com 
DocumentRoot /var/production/myApp 

<Directory /> 
    Order Deny,Allow 
    Deny from all 
    Options None 
    AllowOverride None 
</Directory> 
<Directory /var/production/myApp> 
    Options None 
    AllowOverride None 
    Order allow,deny 
    allow from all 
</Directory> 

WSGIDaemonProcess mysite.com python-path=/var/production/myApp:/var/production/myApp/venv/lib/python2.7/site-packages 
WSGIProcessGroup misite.com 
WSGIScriptAlias//var/production/myApp/myApp/wsgi.py 

Alias /static /var/production/myApp/static 

<Directory /var/production/myApp/static> 
    Options None 
    AllowOverride None 
    Order Allow,Deny 
    Allow from all 
</Directory> 

대체합니다 "는/var/생산 /을 myApp는"이 tutorial

0

질문 1에서 더 많은 도움이 모양을해야하는 경우 : 당신은 WSGI의 모드를 사용 했습니까?

sudo a2enmod mod-wsgi 

질문 2 : AddHandler 문은 어디에 있습니까? 내가 아파치를 생각하지 않는다

<Directory /var/www/> 
    Options Indexes FollowSymLinks MultiViews ExecCGI 
    AddHandler cgi-script .cgi 
    AddHandler wsgi-script .wsgi 
    AllowOverride None 
    Order allow,deny 
    allow from all 
</Directory> 

은 WSGI 응용 프로그램에 .wsgi 파일을 연결하는 방법을 알고있다.

+0

다른 정보를 얻고 싶다면 여기에서 정보를 얻습니다. http://ubuntuforums.org/showthread.php?t=833766 – NuclearPeon