Guest User

Untitled

a guest
Jan 4th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. # Flask app
  2.  
  3. import flask
  4. import flask_bootstrap
  5.  
  6. app = flask.Flask(__name__)
  7. # Setup bootstrap
  8. flask_bootstrap.Bootstrap(app)
  9.  
  10. def foo():
  11.     print('executing foo')
  12.     result = 0
  13.     for i in range(100000000):
  14.         result = i*i
  15.     print('end executing foo', result)
  16.     return result
  17.  
  18. @app.route('/test')
  19. def test():
  20.     import multiprocessing
  21.     process = multiprocessing.Process(target=foo)
  22.     process.start()
  23.     print('returning ok')
  24.     return 'ok'
  25.  
  26. # uwsgi conf
  27. uwsgi:
  28.     virtualenv: /opt/wpsapp/venv
  29.     master: true
  30.     uid: autra
  31.     gid: autra
  32.     socket: /tmp/wpsapp.sock
  33.     chmod-socket: 666
  34.     mount: /wps=wpsapp.app:app
  35.     manage-script-name: true
  36.     processes: 2
  37.     enable-threads: true
  38.     protocol: uwsgi
  39.     need-app: true
  40.     catch-exceptions: true
  41.     #    close-on-exec: true
  42.     #    lazy: true
  43.     lazy-apps: true
  44.     py-auto-reload: 1
Advertisement
Add Comment
Please, Sign In to add comment