Before We Start
This chapter assumes:
- You have your Flask app working locally
- You have a SAP BTP account with Cloud Foundry enabled
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
- Select your subaccount
- Go to: Cloud Foundry → Spaces
Step 3: Create a Space (IMPORTANT)
If you don't have one:
- Click "Create Space"
- Name it: dev (or anything)
- Assign yourself as Developer
No space = no deployment target
Step 4: Get API Endpoint
In BTP Cockpit:
- Go to Cloud Foundry Environment
- Copy API Endpoint
Step 5: Login via CLI
cf login
Enter:
- API Endpoint (from BTP)
- Email + Password
- Org
- Space
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
- Missing space
- Wrong manifest.yml
- Missing dependencies
- Port not configured
Next
Next: APIs and SAP data integration.