Difference between revisions of "Flask"

From Wiki2
Line 5: Line 5:


====running app forever====
====running app forever====
pi@raspberrypi ~ $ sudo supervisorctl
cascada                          RUNNING    pid 2273, uptime 7 days, 3:17:36
supervisor> stop cascada


*nohup python app.py &
*nohup python app.py &

Revision as of 09:36, 19 June 2015

flask

finding port of address already in use

  $ sudo netstat -nlp | grep 80
  tcp  0  0  0.0.0.0:80  0.0.0.0:*  LISTEN  125004/nginx

or

 # sudo lsof -i :25
 COMMAND  PID        USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
 exim4   2799 Debian-exim    3u  IPv4   6645      0t0  TCP localhost:smtp (LISTEN)
 exim4   2799 Debian-exim    4u  IPv6   6646      0t0  TCP localhost:smtp (LISTEN)

http://flask.pocoo.org/docs/0.10/api/#module-flask.json


running app forever

pi@raspberrypi ~ $ sudo supervisorctl
cascada                          RUNNING    pid 2273, uptime 7 days, 3:17:36
supervisor> stop cascada


  • nohup python app.py &
  • use screen
  • run supervisord(link) on system startup and control all through it (pythonic way :))

nohup means: do not terminate this process even when the stty is cut off.

& at the end means: run this command as a background task.

forever with supervisord

flask socketio

https://flask-socketio.readthedocs.org/en/latest/