Django + EdgeOne Pages

The web framework for perfectionists with deadlines. Batteries included, now serverless.

cloud-functions/api/[[default]].py
from django.http import JsonResponse
from django.views import View
import time

class IndexView(View):
    def get(self, request):
        return JsonResponse({
            "message": "Hello from Django Cloud Function!",
            "framework": "Django",
            "timestamp": time.time()
        })

class UserView(View):
    def get(self, request, user_id):
        return JsonResponse({
            "user_id": user_id,
            "username": f"user_{user_id}"
        })

API Endpoints

GET/api/info

Returns Django app metadata and runtime information

GET/api/users/42

Fetch a user by ID via Django URL path converter

POST/api/users

Create a new user with JSON body via json.loads(request.body)

Request Body:

{
  "username": "alice",
  "email": "alice@example.com"
}
GET/api/search?q=django&limit=3

Search with query parameters via request.GET

ORM Support

Powerful Django ORM for database operations with multiple backend support

Built-in Security

CSRF protection, XSS prevention, and secure password handling by default

MVT Architecture

Model-View-Template pattern for clean, maintainable code organization