0

I have created a small REST API using Python and Flask and was able to deploy it on Heroku/GitHub (Cloud version).

I am not able to figure out what all I need to do to deploy the same on my on-premise LINUX Redhat server. I was looking for a step-by-step guide for what all I need to do for this.

SSingh
  • 199
  • 2
  • 11

1 Answers1

0

As pointed out in the documentation here:

http://flask.pocoo.org/docs/dev/deploying/

While lightweight and easy to use, Flask’s built-in server is not suitable for production as it doesn’t scale well.

Now if you are not in production or if it’s a tiny project, you can deploy the files on your server using a client like WinSCP. Then you connect to your server using a ssh client like Putty and finally run:

python your/path/api.py

You can run it as below if you want it to continue executing in the background after you close your Putty window

python your/path/api.py &

Finally if you want to see if your API script is running you can use:

ps -efHa|grep your/path/api.py

It will give you the process Id which you can kill with:

kill <process_id>
Alexis.Rolland
  • 5,724
  • 6
  • 50
  • 77