A simple Django web application for benchmarking and testing purposes, using Django's built-in development server.
- Django Framework: Clean, maintainable Python web framework
- Built-in Server: Uses Django's development server for simplicity
- Health Check: Built-in health monitoring endpoint
- REST API: Clean API endpoints with Django views
- JSON Responses: Structured JSON responses for all endpoints
- Database Ready: SQLite database with Django ORM
- Static Files: WhiteNoise for efficient static file serving
- Framework: Django 4.2.7 (Python web framework)
- Server: Django's built-in development server
- Database: SQLite with Django ORM
- Static Files: WhiteNoise middleware
GET /- Welcome message with application info and endpoint listGET /health- Health check endpointGET /api/users- Sample users dataGET /api/stats- Server statistics and performance metricsPOST /api/echo- Echo back request dataGET /api/echo- Echo endpoint information
pip install -r requirements.txt
python app.pyThe server will start on port 8000 (or PORT environment variable).
PORT- Server port (default: 8000)DEBUG- Enable Django debug mode (default: false)SECRET_KEY- Django secret key for production
This application is designed for deployment on:
- DigitalOcean App Platform
- Heroku
- AWS ECS/Fargate
- Google Cloud Run
- Any container platform supporting Python/Django
To support high RPS, run the app using gunicorn:
pip install -r requirements.txt
cd sample-python-app
export DJANGO_SETTINGS_MODULE=sampleproject.settings
# Example: 8 workers, 16 threads each
gunicorn app:application --workers 8 --threads 16 --bind 0.0.0.0:8000Adjust workers/threads for your CPU. Gunicorn provides robust concurrency for load testing.
curl http://localhost:8000/healthcurl http://localhost:8000/api/userscurl http://localhost:8000/api/statscurl -X POST http://localhost:8000/api/echo \
-H "Content-Type: application/json" \
-d '{"message": "Hello Django!"}'The application uses Django's built-in development server, which automatically:
- Handles database migrations on startup
- Serves static files
- Provides detailed error pages in debug mode
- Auto-reloads on code changes (in development mode)