apache2 mod_wsgi を使用して bottle.py Web アプリケーションをデプロイしようとしています。
以下の指示に従いました。
http://bottlepy.org/docs/dev/deployment.html#apache-mod-wsgi
ファイル /var/www/yourapp/app.wsgi を追加しました:
# Change working directory so relative paths (and template lookup) work again
os.chdir(os.path.dirname(__file__))
import bottle
# ... build or import your bottle application here ...
# Do NOT use bottle.run() with mod_wsgi
application = bottle.default_app()
ファイル yourapp.py を /var/www/yourapp/ に追加しました。
from bottle import route, run, template
@route('/hello/:name')
def index(name='World'):
return template('<b>Hello {{name}}</b>!', name=name)
私は正しいことをしていますか?
HTTP 500 エラーが発生し、ログ内にいくつかのエラーが見つかりました。
[Fri Feb 22 15:03:38 2013] [error] [client 192.168.0.104] os.chdir(os.path.dirname(__file__))
[Fri Feb 22 15:03:38 2013] [error] [client 192.168.0.104] NameError: name 'os' is not defined
ke@dslds /var/log/apache2 $ NameError: name 'os' is not definedNameError: name 'os' is not defined