A sample web application built with Flask and served through Nginx as a reverse proxy. This demonstrates a production-ready pattern for deploying Python web applications.
# Using Docker (recommended)
docker build -t webapp-python-flask .
docker run -p 8080:80 webapp-python-flask
# OR using Python directly
pip install -r requirements.txt
python app.pyThen open http://localhost:8080 (Docker) or http://localhost:5000 (local) in your browser.
- Flask Framework: Lightweight Python web framework
- Nginx Reverse Proxy: Handles static files and proxies dynamic requests
- RESTful API: Sample endpoints demonstrating API patterns
- Static File Serving: Optimized static file delivery through Nginx
- Production Ready: Uses Gunicorn WSGI server for production deployment
GET /- Main web page with application overview
GET /api/health- Health check endpoint- Returns:
{"status": "healthy", "timestamp": "..."}
- Returns:
GET /api/info- Application information- Returns:
{"app": "Flask Web App", "version": "1.0", "python_version": "..."}
- Returns:
Follow these steps to deploy the application in OpenChoreo:
- Set up OpenChoreo following the instructions at https://openchoreo.dev
- Open the Backstage UI and navigate to Create
- Select Component Type: Web Application
- After creation, navigate to the Workflows tab to view builds
- Once the build completes successfully, go to the Deploy tab
- Click Deploy to deploy the application to your environment
- After deployment, navigate to the application URL provided
- Access the web interface and API endpoints
- Docker (recommended)
- OR Python 3+ with pip
Build and run the Docker container:
# Navigate to the application directory
cd webapp-python-flask
# Build the Docker image
docker build -t webapp-python-flask .
# Run the container
docker run -d -p 8080:80 --name flask-app webapp-python-flaskThe application will be available at http://localhost:8080
To stop the container:
docker stop flask-app
docker rm flask-app# Navigate to the application directory
cd webapp-python-flask
# Install dependencies
pip install -r requirements.txt
# Run the Flask development server
python app.pyThe application will start on http://localhost:5000
Note: Local development runs Flask directly without Nginx. For the full Nginx + Gunicorn setup, use Docker.
webapp-python-flask/
├── app.py # Flask application
├── requirements.txt # Python dependencies
├── Dockerfile # Docker build with Nginx + Flask
├── templates/ # HTML templates
│ └── index.html
├── static/ # Static assets
│ └── style.css
└── .nginx/ # Nginx configuration
└── nginx.conf