我试图在Emperor模式下使用uWSGi部署Bottle App。
demo.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()
demo.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
请帮忙
答案 0 :(得分:0)
我终于找到了答案,这似乎是一个愚蠢的错误。 我在打电话
http://localhost/demo
应该在哪里
http://localhost/demo/demo
即
http://localhost/{app_name}/{route_name}