Django REST FrameworkCode GeneratorRuns Out of the Box

Generate a Django REST Framework starter project in one click

Design your API schema with MockMyData, build your entire frontend against live mock endpoints — then export a Django REST Framework starter project with models, serializers, viewsets, and JWT auth as a solid foundation for your real backend.

8

Files generated

0

Boilerplate to write

1

Click to export

What's generated

A complete starter project. Not a skeleton.

Every file is generated from your actual schema — field types, relationships, enum choices, and all. It runs immediately after pip install and migrations. From there, it's yours to extend.

models.py

Django models with correct field types, choices, ForeignKey relations, and indexes

serializers.py

ModelSerializer classes with nested relations, read/write fields, and validation

views.py

ModelViewSet classes with filtering, search, ordering, and pagination pre-configured

urls.py

Router-based URL configuration matching your mock API endpoint patterns exactly

JWT auth

djangorestframework-simplejwt configured with access/refresh token endpoints

settings.py

Django settings with DRF config, CORS, SQLite default (easy to swap to PostgreSQL)

requirements.txt

Pinned dependencies for Django, DRF, simplejwt, django-filter, and more

README

Setup instructions: install dependencies, run migrations, start the dev server

Generated code

Real Django code. From your schema.

Here's what the generator outputs for a field service app schema. Field types, ForeignKey relations, enum choices, and viewset configuration — all derived from your mock API definition.

models.py — generated

Python — Django models

# Generated: models.py
from django.db import models

class Customer(models.Model):
    name = models.CharField(max_length=255)
    email = models.EmailField(unique=True)
    address = models.TextField()
    created_at = models.DateTimeField(auto_now_add=True)

class Job(models.Model):
    STATUS_CHOICES = [
        ('Scheduled', 'Scheduled'),
        ('Enroute', 'Enroute'),
        ('In Progress', 'In Progress'),
        ('Complete', 'Complete'),
    ]
    customer = models.ForeignKey(
        Customer, on_delete=models.CASCADE
    )
    title = models.CharField(max_length=255)
    status = models.CharField(
        max_length=20, choices=STATUS_CHOICES
    )
    scheduled_at = models.DateTimeField()
    latitude = models.FloatField(null=True, blank=True)
    longitude = models.FloatField(null=True, blank=True)

views.py — generated

Python — DRF ViewSet

# Generated: views.py
from rest_framework import viewsets, filters
from rest_framework.permissions import IsAuthenticated
from django_filters.rest_framework import DjangoFilterBackend
from .models import Job, Customer
from .serializers import JobSerializer, CustomerSerializer

class JobViewSet(viewsets.ModelViewSet):
    queryset = Job.objects.select_related('customer').all()
    serializer_class = JobSerializer
    permission_classes = [IsAuthenticated]
    filter_backends = [
        DjangoFilterBackend,
        filters.SearchFilter,
        filters.OrderingFilter,
    ]
    filterset_fields = ['status', 'customer']
    search_fields = ['title', 'customer__name']
    ordering_fields = ['scheduled_at', 'created_at']

Where the Django generator fits in your workflow

01

Design your schema with mock endpoints

Define your models in MockMyData. Get live REST endpoints immediately — start building your React Native, Next.js, or any frontend without touching Django.

Mock API generator →
02

Build and test your frontend fully

Iterate on your UI against realistic fake data. Test edge cases, error states, loading states — all against a real HTTPS endpoint that behaves like your real API will.

Fake API for testing →
03

Export your Django starter project

When the frontend is done, click Export. Get a Django REST Framework starter project that matches your mock API — same endpoints, same response shapes, same field types. Extend it from there.

Django REST Framework generator — common questions

Does the generated Django code actually run out of the box?

Yes. The generated project includes a valid settings.py, requirements.txt, and all app files. You pip install -r requirements.txt, run migrations, and it starts. It's a real working starting point — not stubs you have to fill in. From there, you add your own business logic, deploy config, and any customizations your project needs.

Will my frontend need changes when switching from mock to real?

No. That's the point. The export guarantees the same URL patterns and JSON response shapes as your mock API. You change one base URL constant in your React Native or Next.js app.

Does it handle ForeignKey relationships between models?

Yes. If your mock schema defines a Job with a customer_id FK, the generated models.py has a ForeignKey(Customer, on_delete=models.CASCADE), the serializer has a nested CustomerSerializer, and the viewset uses select_related for query efficiency.

What authentication does the generated project use?

djangorestframework-simplejwt — the most widely used JWT library for DRF. The generated settings.py and urls.py include the /api/token/ and /api/token/refresh/ endpoints pre-configured with sensible token lifetimes.

Does it support PostgreSQL?

The generated project uses SQLite by default so it runs immediately with zero setup. Switching to PostgreSQL is a one-line change in settings.py — Django supports it natively and the generated settings are structured to make that swap straightforward.

Start your Django backend today.

Build your frontend against live mock endpoints, then export a Django REST Framework starter project as a strong foundation for your real backend.

Free tier forever · SQLite default · PostgreSQL-ready

© 2026 MockMyData.io

Home

Mock API Generator

Fake API for Testing

Field Service Example

Docs