A minimal Flask application for testing deployments and API endpoints.
This application provides test endpoints to verify that your deployment is working correctly. It includes health check endpoints, API key authentication, and automatic configuration setup.
pip install -r requirements.txtpython run.pyOpen your browser to: http://localhost:3005
Returns a healthy status response (200).
curl http://localhost:3005/healthReturns an unhealthy status response (503) for testing failure scenarios.
curl http://localhost:3005/unhealthyRequires API key authentication. Returns "protected" data when valid credentials are provided.
curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:3005/api/protectedReturns a JSON list of all available endpoints with documentation.
curl http://localhost:3005/api/endpointsReturns deployment and server information.
curl http://localhost:3005/infoThe application auto-generates a .env file on first run with default test values. For production use, update these values:
API_KEY=your_production_api_key_here
SECRET_KEY=your_secret_key_here
ENVIRONMENT=production
COMMIT_SHA=your_commit_hash
BRANCH=your_branch_namepython -c "import secrets; print('carpathian_prod_' + secrets.token_hex(32))"deployment-example-flask/
├── src/
│ └── app.py # Main application code
├── run.py # Application entry point
├── requirements.txt # Python dependencies
├── .env # Environment configuration (auto-generated)
├── .env.example # Environment template
└── .gitignore # Git ignore rules
Protected endpoints require an API key in the request header:
Option 1: Bearer Token
Authorization: Bearer YOUR_API_KEYOption 2: API Key Header
X-API-Key: YOUR_API_KEYYour API key is located in the .env file after first run.
Push your code to trigger automated deployment via the included workflow.
Set environment variables on your deployment platform:
API_KEY: Your production API keyCOMMIT_SHA: Current commit hashBRANCH: Current branch nameENVIRONMENT: production
The application uses Gunicorn for production serving.
Edit run.py and modify the port parameter:
app.run(host='0.0.0.0', port=YOUR_PORT, debug=False)All application logic is in src/app.py.
Import Errors
pip install -r requirements.txtPort Already in Use Change the port in run.py or stop the process using port 3005.
Missing .env File The application creates this automatically on first run. If deleted, restart the application.
- Flask Documentation: https://flask.palletsprojects.com/
- Carpathian Documentation: https://carpathian.ai/documentation
Developed by Carpathian, LLC