Add FastCGI entrypoint
This commit is contained in:
parent
9525059829
commit
0885019136
1 changed files with 24 additions and 0 deletions
24
run.fcgi
Executable file
24
run.fcgi
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
from flipflop import WSGIServer
|
||||||
|
import sys
|
||||||
|
sys.path.append('/home/edward/src/paddington-eurostar') # isort:skip
|
||||||
|
from app import app # isort:skip
|
||||||
|
|
||||||
|
|
||||||
|
class ScriptNameMiddleware:
|
||||||
|
def __init__(self, wsgi_app, script_name):
|
||||||
|
self.app = wsgi_app
|
||||||
|
self.script_name = script_name
|
||||||
|
|
||||||
|
def __call__(self, environ, start_response):
|
||||||
|
environ['SCRIPT_NAME'] = self.script_name
|
||||||
|
path_info = environ.get('PATH_INFO', '')
|
||||||
|
if path_info.startswith(self.script_name):
|
||||||
|
environ['PATH_INFO'] = path_info[len(self.script_name):]
|
||||||
|
return self.app(environ, start_response)
|
||||||
|
|
||||||
|
|
||||||
|
app.wsgi_app = ScriptNameMiddleware(app.wsgi_app, '/paddington-eurostar')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
WSGIServer(app).run()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue