我正在嘗試使用pico作爲一個小型項目。它使用pico附帶的標準服務器正常工作,但我無法使其在apache上運行。使用mod_wsgi在apache後面設置pico
我已經通過this指南,一切順利,所以我知道mod_wsgi配置正確。
我跟着WSGI設立指示,微微維基的信,但這個嘗試訪問我的頁面時,我得到的錯誤:
GET本地主機/微微/ client.js 404(NOT FOUND)
這會導致「pico未定義」引用錯誤。
我所有的測試代碼位於/ var/WWW /(我試過其他地方也一樣)
微微使用PIP安裝並位於/usr/local/lib/python2.7/ dist-packages/pico(我甚至嘗試修改pico中文件的訪問權限)。
pico.wsgi位於/var/www/pico/pico.wsgi
我pico.wsgi:
import pico.server
import sys
sys.stdout = sys.stderr # sys.stdout access restricted by mod_wsgi
path = '/var/www/' # the modules you want to be usable by Pico
if path not in sys.path:
sys.path.insert(0, path)
# Set the WSGI application handler
application = pico.server.wsgi_app
我可能不會用我的 「路徑」 變量如預期,但我沒有看到它應該引用什麼。
我的httpd.conf:
WSGIScriptAlias /pico /var/www/pico/pico.wsgi
<Directory /var/www/>
Order allow,deny
Allow from all
</Directory>
我的index.html(位於/ var /網絡/):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://d3js.org/d3.v3.js"></script>
<script src="/pico/client.js"></script>
<script src="picoTest.js"></script>
</head>
<body>
<div id="container">
<div id="toolbar"></div>
<div id="graph"></div>
</div>
</body>
</html>
最後,從的sys.path印刷pico.wsgi:
['/var/www/', '/var/www/pico', '/usr/local/lib/python2.7/dist-packages/pip-1.3.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/virtualenv-1.9.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/distribute-0.6.35-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/gevent_websocket-0.3.6-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/daemon-1.0-py2.7.egg', '/home/kjartan/work/risk/maynard', '/var/www/pico', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
我是新來的apache和wsgi在一般情況下,所以可能有一些明顯的我失蹤了。
btw我現在更新了[wiki](https://github.com/fergalwalsh/pico/wiki/WSGI)。 – fergalwalsh
謝謝!它現在完美運作。 –