Use bjoern for production. Add commandline arguments.

This commit is contained in:
Ferdinand Thiessen 2020-09-03 17:56:42 +02:00
parent ea107a28dd
commit 55dc622e11
2 changed files with 14 additions and 6 deletions

View File

@ -1,10 +1,18 @@
#!/usr/bin/python3 #!/usr/bin/python3
from flaschengeist import create_app from flaschengeist import create_app
import bjoern
import argparse
""" Main
Start the backend
"""
if __name__ == '__main__': if __name__ == '__main__':
create_app().run(debug=True, host='0.0.0.0') parser = argparse.ArgumentParser()
parser.add_argument("--host", help="set hostname to listen on", default="127.0.0.1")
parser.add_argument("--port", help="set port to listen on", type=int, default=5000)
parser.add_argument("--debug", help="run in debug mode", action="store_true")
args = parser.parse_args()
app = create_app()
if args.debug:
app.run(args.host, args.port, debug=True)
else:
bjoern.run(app, args.host, args.port, reuse_port=True)

View File

@ -11,7 +11,7 @@ setup(
package_data={'': ['*.yml']}, package_data={'': ['*.yml']},
scripts=['run_flaschengeist'], scripts=['run_flaschengeist'],
install_requires=['Flask >= 1.1', 'PyYAML>=5.3.1', 'sqlalchemy>=1.3', "flask_sqlalchemy", install_requires=['Flask >= 1.1', 'PyYAML>=5.3.1', 'sqlalchemy>=1.3', "flask_sqlalchemy",
"flask_cors", "werkzeug"], "flask_cors", "werkzeug", "bjoern"],
extras_require={ extras_require={
'ldap': [ 'ldap': [
'flask_ldapconn', 'flask_ldapconn',