comparison main.py @ 69:dcf870775c26

Add compability with flask 0.8 In flask version 0.10 (current stable version) the behaviour changed. With this version it is possible to specify the server and port via the config variable SERVER_NAME. To allow this behaviour also with flask 0.8 which is the version shipped with Debian Wheezy this commit extracts the host and port from the SERVER_NAME config variable.
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 05 Jan 2015 12:37:56 +0100
parents 5c3aba401382
children
comparison
equal deleted inserted replaced
68:4645e50539ff 69:dcf870775c26
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 if __name__ == "__main__": 2 if __name__ == "__main__":
3 from odfcast import app 3 from odfcast import app
4 app.run() 4
5 server_name = app.config['SERVER_NAME']
6 if server_name and ':' in server_name:
7 host, port = server_name.rsplit(':', 1)
8 port = int(port)
9 else:
10 port = 5000
11 host = "127.0.0.1"
12
13 app.run(host=host, port=port)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)