Back to Templates

Python Flask - Cloud Functions on EdgeOne Pages

Use Flask on EdgeOne Pages with decorator routing and Blueprint support.

View Demo
Use Flask on EdgeOne Pages with decorator routing and Blueprint support.

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

MethodPathDescription
GET/api/Root endpoint
GET/api/healthHealth check
GET/api/infoFunction information
GET/api/timeCurrent server time
GET/POST/api/echoEcho request info
POST/api/jsonHandle JSON body
GET/api/users/:idGet user by ID
POST/api/usersCreate new user
GET/api/searchSearch with query params

๐Ÿ“š Documentation

๐Ÿ“„ License

This project is licensed under the MIT License.