DEV Community

Lord_Doug
Lord_Doug

Posted on

DjReframe: a lib to cut down the routine of building Django apps from scratch

I haven't been using Django for very long .I'm still early on that road. But I've always liked practical things, and one thing bugged me fast: every time you need to create a new app, there's a ton of manual editing involved — creating folders, creating files, organizing everything from zero.

Imagine having to build one or more APIs. Each one might need 5 to 8 extra files (serializers, permissions, selectors, services, tests...). Every time, the same repeated work.

That's why I built DjReframe: you set up the structure you want once, and after that it's just one command ,the whole architecture comes out ready. You can have several predefined structures and use whichever you want, whenever you want.

How it works

Install it:

pip install dj-reframe
Enter fullscreen mode Exit fullscreen mode

And generate the app already in the architecture you need:

# Traditional web app
dj-reframe blog sitev1

# API with Django REST Framework
dj-reframe api drf

# App with WebSockets
dj-reframe chat websockets
Enter fullscreen mode Exit fullscreen mode

No more creating files one by one by hand.

Available architectures

DjReframe already ships with several ready-made options, including:

  • sitev1 / sitev2 — traditional web app (with or without a service layer)
  • api — full DRF setup (serializers, permissions, pagination, tests)
  • api-graphql — GraphQL API with Strawberry/Graphene
  • websockets — consumer/routing-based apps
  • celery-tasks — apps focused on async tasks
  • microservice, admin-centric, ml-integration ,and more

Custom templates
If none of the built-in architectures fit, you can create your own:

dj-reframe --my-templates
Enter fullscreen mode Exit fullscreen mode

This opens the folder where you build your own structure — you just need to name Python files with .py-tpl (Django/DjReframe automatically converts them to .py when generating).

Requirements
Python >= 3.10
Django >= 4.0

The project is open source, MIT licensed, and open to contributions — PRs are welcome.

🔗 Repo: https://github.com/DougVikt/dj-reframe
📦 PyPI: pip install dj-reframe

If you find it useful, drop a ⭐ on the repo. And if you have ideas for new architectures or templates, open an issue.

Top comments (0)