0

I am building a back end in python via the python flask application from IBM Cloud/Bluemix. I have heard/read a lot about people complaining regarding that Flasks built in server isn’t good for production. But how do I know if the application uses the Flask built in server or if IBM sets something else? Is there a simple way to see this in the code?

danielo
  • 770
  • 2
  • 13
  • 32

1 Answers1

2

Deploying the Flask boilerplate app from the IBM cloud catalogue will indeed deploy a Flask application running on the Flask dev webserver.

You will need to alter the application if you want to run a production WSGI server.

I work for IBM and am in this stuff all day every day.

If you want to verify this, SSH into your application container on Cloud Foundry with the bash command

cf ssh <yourappnamehere>

You will need to have either the bluemix or cloud foundry CLIs installed and be logged in to the relevant endpoint before submitting this command.

It will open a bash shell in your application container, and you can cd around and open and/or download your project files for inspection.

This line:

app = Flask(__name__)

is a sure fire way to know that you are running a Flask web server application.

If you are concerned with which WSGI server your application is running under, checking your procfile (you should see this when SSHing int your container) will show you which command starts your application. If the command is

python <yourapp>.py

then you are running the dev server. Otherwise, you would be running some other python file, most likely via the server's command rather than the python command, that would import your application as a dependency.

You can also take a look at whether or not any WSGI server libraries were downloaded during the compilation of your droplet, and what command was used to start your application with

cf logs <yourappname> --recent

after deploying it.

Or, you can just believe me that the boilerplate deploys a Flask app under a Flask dev server.

A tutorial on running Flask on a different WSGI server:

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04

John R
  • 1,505
  • 10
  • 18