을 실행에 더 많은 애플 리케이션을 추가 :내가이처럼 보이는 응용 프로그램이 gevent pywsgi.WSGIServer
application = DirectoryApp(
'app/static',
index_page='index.html',
hide_index_with_redirect=True)
if __name__ == '__main__':
config = get_config()
from gevent import pywsgi
server = pywsgi.WSGIServer((config['host'], config['port']), application)
server.serve_forever()
는 서버가 시작된 후 코드를 사용하여 스택에 다른 응용 프로그램을 추가 할 수 있습니까? 내가 원하는의 라인을 따라 뭔가를 할 수있을 것입니다 :
# Create new application class
class AnotherController((object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
from webob import Request, Response
req = Request(environ)
if req.method == 'GET' and req.path_info.startswith('/anothercontroller'):
res = Response(
body='Hello World, Another Controller!',
status=200,
content_type='text/plain'
)
return res(environ, start_response)
return self.app(environ, start_response)
def add_application():
global application
application = AnotherController(application)
# Add the application to the stack after the fact it is already running
add_application()
문제 이렇게하여 결코 내가 응용 프로그램 스택의 상단에 넣어 새 응용 프로그램 클래스의 __call__
에 간다 없다는 것입니다 . 나는 서버가 실제로 사용하고있는 스택에 영향을주지 않을거야 것 같다 나에게
...
여러 WSGI 애플 리케이션을로드하는 데 사용하는 페이스트의 캐스케이드를 사용할 수
나는이 방법이 있다고 생각하지 않습니다. WSGI는 한 번에 하나의 응용 프로그램을 실행하도록 설계되었습니다. 장고, 피라미드, 또는 플라스크와 같은 프레임 워크를 사용한다면 Flask의 청사진과 같은 다른 패턴이 있습니다. – Anorov