Skip to main content

Get started with Python Flask Framework on IBM Bluemix

Get started with Python Flask Framework on IBM Bluemix

The tutorial will develop a Python web application based on Flask framework and deploy the app on IBM Bluemix. The app shows up a basic form which users can type their names. When hit enter the name will be added to database and can be accessed at http://base_url/api/visitors

1. Requirement

2. Clone example code and run locally

git clone
cd get-started-python

  • Rename your app
Open up,manifest.yml similar like:
        - name: Lecheebot
        random-route: true
        memory: 128M
now, you can run your app locally by typing the command:
pip install -r requirements.txt
Your app is now accessible at http://localhost:8080

3. Deploy to IBM Bluemix using Cloud Foundry CLI

Ensure you have IBM Bluemix account and installed CF CLI on your machine. if not, follow the steps: [
  • Log in to CF CLI
Run CMD as administrator, then login to CF with the commands:
cf api
cf login
Enter your email and password.
  • Deploy your app
Open CMD at your app reposit that you cloned in step 2. Execute the command to deploy your app:
cf push
You can view your app status by the command:
cf apps

4. Add Database

  • To connect to Cloudant NoSQL DB, follow these steps:
  • Navigate to your app. Click on "Connect new" button on Connections Group. Choose Cloudant NoSQL DB service on the categories. Finally, click Create button.
  • Ensure that you connect Cloudant NoSQL DB service to your application. If not, click on the "Connect existing" to connect with service.
Now, You can test your app at your app URL.
  • To connect Database for working locally:
  • Create a file with the name vcap-local.json
  • Add the following detail:
 "services": {
   "cloudantNoSQLDB": [
       "credentials": {
        "username": "<your_username>",
        "password": "<your_password>",
        "host": "your_host",
        "port": 443,
        "url": "yoururl"

       "label": "cloudantNoSQLDB"
You can find the username, password, host by click on Cloudant NoSQL DB service at your IBM Blumix console. Then click on "Service Credentials". Copy and pass information to your vcap-local.json file.
Now you can test your app locally with the connected database.


  1. It was an excellent article to hear from you which is very useful. Thank you so much for gathering all this information on how to get started with Python Flask Framework on IBM Bluemix, it’s very clever and will be extremely helpful for all people.


Post a Comment

Popular posts from this blog

OpenHab2 - MQTT binding demo

Install Eclipse Kura on Orange Pi Zero (9$; 512MB of RAM)

Install Node-RED on Orange Pi