Chapter 7: Deploy to SAP BTP Cloud Foundry (Full Guide)

From zero setup → live application (step-by-step)

Before We Start

This chapter assumes:

If you skip setup steps, deployment WILL fail. Follow in order.

Step 1: Install Cloud Foundry CLI

Go here:

https://docs.cloudfoundry.org/cf-cli/install-go-cli.html

Download and install for your OS.

Verify installation:

cf version
If you see a version number, you're good.

Step 2: Access SAP BTP

Go to:

https://cockpit.btp.cloud.sap

Step 3: Create a Space (IMPORTANT)

If you don't have one:

No space = no deployment target

Step 4: Get API Endpoint

In BTP Cockpit:

Step 5: Login via CLI

cf login

Enter:

You should now be connected to BTP.

Step 6: Prepare Your App

requirements.txt

flask pandas openpyxl

Procfile

web: python app.py

manifest.yml

applications: - name: material-report-app memory: 512M buildpacks: - python_buildpack
manifest.yml controls how your app runs in the cloud.

Step 7: Fix Flask for Cloud

import os port = int(os.environ.get("PORT", 5000)) app.run(host="0.0.0.0", port=port)

Step 8: Deploy

cf push

Watch logs carefully.

What Success Looks Like

requested state: started instances: 1/1 routes: https://your-app.cfapps...

Open URL → your app is live.

Debugging

cf logs material-report-app --recent
Most errors are visible here.

Common Mistakes

Next

Next: APIs and SAP data integration.

End of Chapter 7