]> ToastFreeware Gitweb - chrisu/seepark.git/blobdiff - web/README
add notes about waitress to README
[chrisu/seepark.git] / web / README
index aa14624ef39e10e4a1274f7c78d6f90265f6bfe6..2b6b5554efe5048b6f7733a1069605448484fe97 100644 (file)
@@ -1,12 +1,60 @@
-Needed packages: python3-flask python3-sqlalchemy python3-mysqldb
+Needed packages: (python3-flask python3-sqlalchemy) python3-mysqldb python3-flask-sqlalchemy
 
 Start with:
 FLASK_APP=seepark_web.py FLASK_DEBUG=1 SEEPARKINI=~/seewasser.ini flask run
 
+Option:
+-h 0.0.0.0
+at the end to listen on all interfaces, i.e.
+FLASK_APP=seepark_web.py FLASK_DEBUG=1 SEEPARKINI=~/seewasser.ini flask run -h 0.0.0.0
+(or :: instead of 0.0.0.0 for ipv4+ipv6)
+
+
 Go to:
 http://127.0.0.1:5000/
+or http://<ipaddress>:5000/
+if the app is running on a different machine
 
-Option:
--h 0.0.0.0
-to listen on all interfaces
+---
+
+notes on a "production" server:
+
+needed: python3-waitress
+
+version 1:
+
+1) add to web/seepark_web.py:
+from waitress import serve
+
+if __name__ == "__main__":
+    #app.run()
+    serve(app, listen='*:5000')
+
+2) run:
+SEEPARKINI=~/seewasser.ini python3 web/seepark_web.py
+
+version 2:
+
+1)
+touch web/__init__.py
+
+2)
+add to web/seepark_web.py:
+def create_app():
+    return app
+
+3)
+run:
+SEEPARKINI=~/seewasser.ini waitress-serve --port 8765 --call 'web.seepark_web:create_app'
+
+
+links:
+
+http://flask.pocoo.org/docs/1.0/tutorial/deploy/
+http://flask.pocoo.org/docs/1.0/tutorial/factory/
+https://github.com/pallets/flask/blob/1.0.2/examples/tutorial/flaskr/__init__.py
+
+https://docs.pylonsproject.org/projects/waitress/en/latest/
+https://docs.pylonsproject.org/projects/waitress/en/latest/runner.html#runner
 
+https://gr33ndata.blogspot.com/2012/01/waitress-flask.html