Back to Templates
Python Flask - Cloud Functions on EdgeOne Pages
Use Flask on EdgeOne Pages with decorator routing and Blueprint support.
| Framework | Python |
| Use Case | Starter,Cloud Functions |
Python Cloud Functions - Flask | EdgeOne Pages
A demonstration website based on Next.js + Tailwind CSS, showcasing how to deploy Flask web applications as serverless functions on EdgeOne Pages.
๐ Features
- Flask Framework: The most popular Python micro web framework
- Decorator Routing: Familiar
@app.route()syntax - Blueprint Support: Organize your code with Flask blueprints
- Modern UI: Black background with white text theme
- Real-time API Demo: Test the Flask function directly from the webpage
๐ ๏ธ Tech Stack
Frontend
- Next.js 15 - React full-stack framework
- React 19 - User interface library
- TypeScript - Type-safe JavaScript
- Tailwind CSS 4 - Utility-first CSS framework
Backend
- Flask - Python micro web framework
- Cloud Functions - EdgeOne Pages serverless functions
๐ Project Structure
python-flask-template/
โโโ src/ # Next.js frontend
โโโ cloud-functions/ # Python cloud functions
โ โโโ api/
โ โ โโโ [[default]].py # Flask application
โ โโโ requirements.txt # Python dependencies
โโโ public/ # Static assets
โโโ package.json # Project configuration
๐ Quick Start
Requirements
- Node.js 18+
- Python 3.9+
- EdgeOne CLI
Install Dependencies
npm install
Development Mode
edgeone pages dev
Visit http://localhost:8088 to view the application.
๐ฏ API Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/ | Root endpoint |
| GET | /api/health | Health check |
| GET | /api/info | Function information |
| GET | /api/time | Current server time |
| GET/POST | /api/echo | Echo request info |
| POST | /api/json | Handle JSON body |
| GET | /api/users/:id | Get user by ID |
| POST | /api/users | Create new user |
| GET | /api/search | Search with query params |
๐ Documentation
- Flask Documentation: https://flask.palletsprojects.com
- EdgeOne Pages Docs: https://pages.edgeone.ai/document/python
๐ License
This project is licensed under the MIT License.