2012-03-08 47 views
3

我有使用Python框架瓶(類似Django的)寫了一個網站,但我無法與Ubuntu的服務器上它給了指令(用的Apache2和mod_wsgi的部署)。現在,而不是顯示網頁,URL只是給像ftp的目錄。下面是我的websitename.wsgi文件:的Apache + mod_wsgi的+瓶(類似Django的)不工作

import sys 
sys.path.insert(0, '/var/www/websitename') 

from websitename import app as application 

,下面將我插入apache2.conf部分:

ServerName localhost 

WSGIDaemonProcess websitename user=www-data group=www-data threads=5 
WSGIScriptAlias /websitename /var/www/websitename/websitename.wsgi 

<Directory /var/www/websitename > 
    WSGIProcessGroup websitename 
    WSGIApplicationGroup %{GLOBAL} 
    Order deny,allow 
    Allow from all 
</Directory> 

和/ var/WWW/websitename目錄是這樣的:

/websitename 
/websitename.py 
/static 
    /style.css 
/templates 
    layout.html 
    index.html 
    login.html 
    ... 
/scripts 
    __init__.py 
    somescript.py 

任何人都可以提出一些建議是什麼問題?的apache.conf?

UPDATE: 我們得到了錯誤的MSG像下面。任何提示?

[Mon Mar 12 12:23:32 2012] [error] [client 157.55.17.200] File does not exist: /var/www/robots.txt 
[Mon Mar 12 12:23:33 2012] [notice] caught SIGTERM, shutting down 
[Mon Mar 12 12:23:34 2012] [warn] mod_wsgi: Compiled for Python/2.7.2rc1. 
[Mon Mar 12 12:23:34 2012] [warn] mod_wsgi: Runtime using Python/2.7.2+. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31835): Starting process 'mywsgiapp' with uid=33, gid=33 and threads=5. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31835): Initializing Python. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31836): Initializing Python. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31837): Initializing Python. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31838): Initializing Python. 
[Mon Mar 12 12:23:34 2012] [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 Python/2.7.2+ configured -- resuming normal operations 
[Mon Mar 12 12:23:34 2012] [info] Server built: Feb 14 2012 16:35:35 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31840): Initializing Python. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31839): Initializing Python. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31835): Attach interpreter ''. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31836): Attach interpreter ''. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31838): Attach interpreter ''. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31837): Attach interpreter ''. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31840): Attach interpreter ''. 
[Mon Mar 12 12:23:34 2012] [info] mod_wsgi (pid=31839): Attach interpreter ''. 
[Mon Mar 12 12:25:41 2012] [error] [client 128.192.240.] File does not exist: /var/www/favicon.ico 
[Mon Mar 12 12:25:41 2012] [info] mod_wsgi (pid=13463): Initializing Python. 
[Mon Mar 12 12:25:41 2012] [info] mod_wsgi (pid=13463): Attach interpreter ''. 
[Mon Mar 12 12:26:27 2012] [error] [client 128.192.240.] File does not exist: /var/www/favicon.ico 
[Mon Mar 12 12:26:27 2012] [info] mod_wsgi (pid=17315): Initializing Python. 
[Mon Mar 12 12:26:27 2012] [info] mod_wsgi (pid=17315): Attach interpreter ''. 
[Mon Mar 12 12:26:28 2012] [info] mod_wsgi (pid=17367): Initializing Python. 
[Mon Mar 12 12:26:28 2012] [info] mod_wsgi (pid=17368): Initializing Python. 
[Mon Mar 12 12:26:28 2012] [info] mod_wsgi (pid=17367): Attach interpreter ''. 
[Mon Mar 12 12:26:28 2012] [info] mod_wsgi (pid=17368): Attach interpreter ''. 
[Mon Mar 12 12:26:31 2012] [info] mod_wsgi (pid=17559): Initializing Python. 
[Mon Mar 12 12:26:31 2012] [info] mod_wsgi (pid=17559): Attach interpreter ''. 
+0

你能在[modwsgi(http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide)現場工作的問候詞? – 2012-03-08 23:02:52

+0

這些說明看起來不是很複雜,我們的計算機管理器一直在玩這些設置很長一段時間。它仍然沒有工作。那裏有一些變數特別重要嗎? – Jingping 2012-03-09 19:54:31

+0

不要向hello世界食譜添加任何東西。忘記燒瓶,你的目錄結構和其他一切。只需按照說明完全。如果你好世界不起作用,你就無法做任何事情。 – 2012-03-09 22:05:34

回答

1

我不知道你是否還在檢查這個。你有以下幾行你websitename.py

if __name__ == '__main__': 
    app.run() 

除了從瓶手冊:

問題:應用程序不運行,錯誤日誌顯示SystemExit忽略。 您的應用程序文件app.run()調用不被

if __name__ == '__main__': 
    condition. 

守衛希望這有助於。