2012-10-13 44 views
0

我试图在Emperor模式下使用uWSGi部署Bottle应用程序。如何使用Emperor模式在uWSGi上部署Bottle应用程序

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

我终于能够找到答案,它似乎是一个愚蠢的错误。 我打电话

http://localhost/demo 

地方,因为它应该是

http://localhost/demo/demo 

http://localhost/{app_name}/{route_name} 
相关问题