0

I have a created a flask based application on my local machine.

I need to deploy on standalone server and have few questions related to the same.

a> Deployment: instead of creating the requirement.txt and using pip, is there a way where I can bundle all the required packages and my code into one bundle and then deploy that bundle on server.

b> Execution: Once the application is deployed, what is the process of executing the application. 1> can I call the wrapper script that will call the python main flask .py via some scheduler that will run continuosly or 2> is there a flask service that I can call in background and that will take care of running the app continuously.

thanks

goten
  • 43
  • 2
  • Not sure about a) but when you put your project to the VM/server, you will just have to run the main_flask.py and it will be accessable by the url: "http://VM_ip_adress:port_number". After running the app you can press Ctrl+z to stop it and then type: bg, to put it to background and it will work. – boandriy Sep 12 '18 at 16:14

1 Answers1

0

I would suggest using some sort of a server, like uwsgi or gunicorn to run your flask app. You can wrap it in a system service or use a process manager like supervisor to manage the process. Also having nginx in front of uwgi is sometimes usefull especially if you have static assets to serve.

Regarding the deployment - it will all depend on how you actually get the code to the server and git pull + pip install is by far my favourite way. Bundling the dependencies can be a bit problematic because some do need to be compiled. If you absolutely need to deploy everything without pip, maybe have a look at building a container and deploying that.

dmitrybelyakov
  • 2,448
  • 2
  • 17
  • 21