]> ToastFreeware Gitweb - chrisu/seepark.git/blob - web/README
add notes about waitress to README
[chrisu/seepark.git] / web / README
1 Needed packages: (python3-flask python3-sqlalchemy) python3-mysqldb python3-flask-sqlalchemy
2
3 Start with:
4 FLASK_APP=seepark_web.py FLASK_DEBUG=1 SEEPARKINI=~/seewasser.ini flask run
5
6 Option:
7 -h 0.0.0.0
8 at the end to listen on all interfaces, i.e.
9 FLASK_APP=seepark_web.py FLASK_DEBUG=1 SEEPARKINI=~/seewasser.ini flask run -h 0.0.0.0
10 (or :: instead of 0.0.0.0 for ipv4+ipv6)
11
12
13 Go to:
14 http://127.0.0.1:5000/
15 or http://<ipaddress>:5000/
16 if the app is running on a different machine
17
18 ---
19
20 notes on a "production" server:
21
22 needed: python3-waitress
23
24 version 1:
25
26 1) add to web/seepark_web.py:
27 from waitress import serve
28
29 if __name__ == "__main__":
30     #app.run()
31     serve(app, listen='*:5000')
32
33 2) run:
34 SEEPARKINI=~/seewasser.ini python3 web/seepark_web.py
35
36 version 2:
37
38 1)
39 touch web/__init__.py
40
41 2)
42 add to web/seepark_web.py:
43 def create_app():
44     return app
45
46 3)
47 run:
48 SEEPARKINI=~/seewasser.ini waitress-serve --port 8765 --call 'web.seepark_web:create_app'
49
50
51 links:
52
53 http://flask.pocoo.org/docs/1.0/tutorial/deploy/
54 http://flask.pocoo.org/docs/1.0/tutorial/factory/
55 https://github.com/pallets/flask/blob/1.0.2/examples/tutorial/flaskr/__init__.py
56
57 https://docs.pylonsproject.org/projects/waitress/en/latest/
58 https://docs.pylonsproject.org/projects/waitress/en/latest/runner.html#runner
59
60 https://gr33ndata.blogspot.com/2012/01/waitress-flask.html