我正在尝试在 Emperor 模式下使用 uWSGi 部署一个 Bottle App。
演示.py
import os
from bottle import Bottle, route, run
app=Bottle()
@app.route('/index')
def index():
return "Hello world! "
@app.route('/:name')
def hello(name):
return "hello %s" % name
# Mod WSGI launch
os.chdir(os.path.dirname(file))
application = bottle.default_app()
演示.ini
[uwsgi]
# Variables
base = /opt/apps/webapp/demo
app = demo
# Geneic Config
plugins=http,python
home = /opt/apps/webapp/demo
pythonpath=%(base)
socket = /tmp/%n.sock
module = %(app)
logto = /var/log/uwsgi/%n.log
日志文件中的输出
gracefully (RE)spawned uWSGI master process (pid: 2414)
spawned uWSGI worker 1 (pid: 2646, cores: 1)
[pid: 2646|app: -1|req: -1/1] 10.0.0.240 () {40 vars in 688 bytes} [Sat Oct 13 15:00:00 2012] GET /demo => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
announcing my loyalty to the Emperor...
[pid: 2646|app: -1|req: -1/2] 10.0.0.240 () {40 vars in 688 bytes} [Sat Oct 13 15:00:05 2012] GET /demo => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
[pid: 2646|app: -1|req: -1/3] 10.0.0.240 () {42 vars in 719 bytes} [Sat Oct 13 15:00:26 2012] GET /demo => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
但是在浏览器上我仍然看到这个错误
uWSGI Error
Python application not found
请帮忙