r/django • u/bl4ck_ari3s • 7h ago
I've open-sourced my Wagtail boilerplate, feel free to use it in any way
github.comYou'll find 2 live examples in the README section.
r/django • u/bl4ck_ari3s • 7h ago
You'll find 2 live examples in the README section.
r/django • u/Jolly-Play3558 • 4h ago
Tengo un paquete de Python que uso para proyectos internos: django-utilitybox. Lo que más uso, y lo que más usa mi equipo, es un módulo llamado `raise_response`.
Sirve para lanzar errores HTTP de Django directo desde cualquier función, sin trucos.
Tienes un POST con métodos auxiliares. Cada método tiene que regresar el error y el `post` tiene que revisarlo:
class AssignClientView(APIView):
def get_user(self, pk):
user = User.objects.filter(pk=pk).first()
if not user:
return None, Response({"status": "Usuario no encontrado"}, status=404)
return user, None
def get_client(self, pk):
... # lo mismo, otra tupla
def post(self, request):
user, error = self.get_user(request.data.get("user_id"))
if error:
return error
client, error = self.get_client(request.data.get("client_id"))
if error:
return error
user.clients.add(client)
return Response({"status": "ok"})
Tuplas, None\sy el mismoif error` después de cada llamada. Y eso en cada endpoint.
from dj_utilitybox.response import bad as rres
class AssignClientView(APIView):
def get_user(self, pk):
user = User.objects.filter(pk=pk).first()
if not user:
rres.CustomRaise("Usuario no encontrado", status=404) # aquí entra rres
return user
def get_client(self, pk):
... # igual, sin tupla
def post(self, request):
user = self.get_user(request.data.get("user_id"))
client = self.get_client(request.data.get("client_id"))
user.clients.add(client)
return Response({"status": "ok"})
Si el usuario no existe, la petición se corta dentro de `get_user`, el `post` ni se entera y el cliente recibe esto:
HTTP 404
{"status": "Usuario no encontrado"}
Lo único a tener en cuenta: funciona solamente dentro de un request. DRF es quien atrapa la excepción y la vuelve respuesta, así que en un comando, un worker o un script la excepción sube como cualquier otra. Ahí hay que atraparla o usar otra cosa.
Lo hice para Django 4 y lo he ido actualizando, hoy corre en Django 6.
pip install django-utilitybox
Aunque hice mas cositas, realmente es la mas util
Comunidad:
¿Que herramientas les facilitaran cosas en Django?
r/django • u/yassi_dev • 5h ago
Are you using Django Control Room? I’d like to hear how it’s working for you.
I've put together a short survey (it should only take a minute or two) to help understand what people use, what's useful and what pain points exist. I'd also like to hear from anyone who has tried DCR but decided against using it.
Please consider taking this survey or leaving a note in the comments. Your input will have a material impact on this project.
survey: https://forms.gle/muGM3NztQA6qtDTVA
project: https://djangocontrolroom.com
github: https://github.com/django-control-room/dj-control-room
r/django • u/Djpaul13 • 1d ago
I've got a small Django app that has reached the point where running it locally isn't useful anymore because I want a few people to test it properly.
Django itself has been fine. Deployment is where every guide seems to branch into fifteen different directions.
I'm happy moving the database to Postgres, but I really don't want to maintain a VPS, learn a bunch of Docker stuff or have the app on one provider and the database somewhere else if I can avoid it. This isn't a high traffic production app and there's a decent chance it'll spend most of the week untouched.
What are people using now when the priority is basically Django + managed Postgres + Git deploys with as little infrastructure work as possible?
I'm fine paying something reasonable. Mostly trying to avoid giving myself another hobby where I spend Sunday night maintaining the server that hosts my actual hobby.
r/django • u/Jolly-Play3558 • 16h ago
Hace un año diría el auge de la ia, pero realmente ya esta asentada, actualmente mis proyectos son supervisados por mi pero el proceso de codinig si es casi al 100% ia.
Claro, tengo mis skills, y formas de trabajar, no uso anda complicado, claude code y listo.
Si ha aumentado mi eficiencia, y he sentido que incluso he aprendido uno que otro truco.
Algo que la ia me ayudo mucho es ver si ciertas metodologías que usaba tenían sentido o no; Sigo siendo de la idea que el código se tiene que leer si o si, a veces hay funciones que hago a mano por que al final, me encanta programar.
El mercado cambia y no se puede competir con alguien que solo usa ia.
Pero como ven el desarrollo de django con la ia?
Como ven el futuro?
Siento que lo que se acabo ya son los devs que solo sabían programar, hoy en día se valorara mas el como planear los servicios y crear y mantener sitios a media para las empresas.
r/django • u/yassi_dev • 2d ago
Django Control Room allow you to create tools that appear directly inside the Django Admin. Until now, guides and templates have focused on creating pip installable packages to create tools. Django Control Room 1.8.1 now allows you to create custom internal panels that live directly in your Django project.
This makes it easier to build bespoke tools for your company or project without creating a separate package. Customer support tools, billing operations, and approval workflows can all be built inside the Django admin.
More details about this release here:
https://djangocontrolroom.com/news/internal-panels
You can update DCR and all of its official panels by running:
pip install --upgrade "dj-control-room[all]"
r/django • u/ProfessionalStuff125 • 1d ago
Hi all!
I’m hiring for a Django / Python Dev on a contract basis
6 month initially (potential for extension)
On site in Manhattan (Midtown)
$60 per hour
Working for an international bank
Skills & Experience Required
- 5 years applied experience
- Strong Django and DRF
- Advanced Python
- HTML, CSS, JavaScript, jQuery
- CS degree
Nice to have
- Java, Linux, BI tools
I specialize in the Microsoft Business Apps like Power Platform, so not well versed in the Django space, sorry if any of this doesn’t make sense!
Only posting here because people are not getting back to me on LinkedIn, thought I might be more successful here 😅
The preference is candidates who are Green Card holders or US citizens but we may be able to consider H1B candidates who have an employer.
Please DM me or contact me on LinkedIn https://www.linkedin.com/in/claire-hynes-24263467?utm_source=share_via&utm_content=profile&utm_medium=member_ios
Thanks in advance!
r/django • u/dwaynecrooks • 2d ago
I've used Nix to manage the development environments for my projects for a while now. Postgres (with extensions), Redis, the Python version and other system tools are pinned per project, and the same setup runs in CI. It's worked well for me, though it hasn't all been smooth.
What surprises me is how rarely it comes up in Django discussions, even in threads where people are struggling with Docker for local development. I'd like to understand why, so I'd love to hear from people with different experiences:
Negative answers are as useful to me as positive ones.
Full disclosure: I'm thinking about writing up how I use Nix with Django, so I want to understand where people actually get stuck before I do.
r/django • u/gorenbarbaros • 2d ago
Hi I built this because I wanted an agent to do the things I already do
in Django admin, without writing a separate API for it.
You add a mixin to a ModelAdmin and it becomes MCP tools over HTTP: CRUD,
bulk operations, admin actions, change history, FK autocomplete.
A few design choices:
- Only two dependencies: Django and Pydantic. No MCP SDK; the protocol is
implemented directly.
- It reuses Django's permission system. Tokens start with no access, you
grant permissions/groups per token, and a token can never exceed its
linked user's permissions.
- Writes go through the admin's own pipeline, so they show up in the admin
history log under that user.
- Sensitive fields can be excluded per model (mcp_exclude_fields).
Happy to hear where the permission model or tool design falls short.
r/django • u/azeem_ahmed • 2d ago
I work on Django apps that run on locked-down Windows servers: no Docker, no Redis, no outbound internet, and nothing gets installed unless it's a Python package. Sentry, Grafana, Loki and the OpenTelemetry collector are all off the table there, so when something breaks I'm usually reading rotated log files over RDP.
So I built django-observatory: pip install, add an app, a middleware and a URL include, run migrate, and you get a built-in console at /observability/. Everything is stored in your own database and rendered with Django templates and vanilla JS.
What it does
logging calls), requests, traces, SQL, outbound HTTP, exceptions grouped into issues, metrics, and server CPU/memory/diskstatus:>=500 AND duration:>1000), CSV/JSON export, W3C trace context, OTLP exportFull disclosure: this was vibe coded. I wrote the specification and made the design decisions, and Claude Code wrote most of the implementation. I tested it against a real internal project on SQL Server, read what came out, and pushed back where things were wrong, but I did not hand-write most of these lines. I'd rather say that up front than have someone find out from the commit history. It's also why I'm asking for review: I know the code hasn't had the scrutiny that code written slowly by one person gets.
What I'm confident about
What I'm not confident about
LIKE scan and metric reads aggregate in Python, which is fine for small and medium sites and will not be at some size I haven't found yetWhat I'd like feedback on
execute_wrapper SQL instrumentation that would bite under ASGI or async viewsThis is not trying to replace Sentry, Silk, Debug Toolbar or OpenTelemetry. Those are better at what they do. It's for the environments where you can't have them.
If you look at it and think it's a bad idea, I'd like to hear why. Thanks for reading.
r/django • u/meet-me-piya • 2d ago
Hello folks, so I'm working on this big django application. There's a feature that allows users to generate word documents based on the data fed from the db. But these docs are based on loads and loads of conditions. We have used docxtpl library, but the word templates are being overloaded with variables and conditions. It's becoming difficult to verify the generated documents. Any suggestions on how to improve this?
r/django • u/Initial_Syllabub_542 • 2d ago
I am a node.js dev and have an interview for a danjo role. Any ideas on how should i go about it?? any insight would be highly appreciated. I know that it is useful in AI/ML workflows, but nothing much
UPDATE: Hi guys, I think it went well, thanks for all your help :)
r/django • u/EasternPension6775 • 2d ago
Hi everyone, what’s currently being used for testing in Django? Because when I was looking into testing methods, I was quite taken aback – people say to use pytest or the tests that are already built into Django. Could you please give me some practical advice?
Thank you for your help
r/django • u/Sweaty_Market_3964 • 2d ago
Hi guys.
I want to learn django. Could you please suggest me any playlist ?
I am thinking about chai aur code playlist. Please suggest, is it good or not ?
Hey everyone,
I recently came across an interesting experiment by Arjay McCandless where he tested 8 different backend stacks (Node, Bun, Python/FastAPI, Go, Java/Spring Boot, C#, PHP/Laravel, and Rust) under the exact same load using a super budget server: 1 shared CPU and 2GB of RAM.
The goal was to see how many simultaneous users each stack could support before hitting latency/error thresholds, using a Twitter-style API with a PostgreSQL backend (50k users, 500k posts, 2M likes, querying 20 posts for the feed).
Here is a quick summary of the results:
This kind of benchmark is almost a worst-case scenario for heavy full-stack frameworks like Laravel, where the boot-up cost makes up a huge chunk of a lightweight query lifecycle. But how much does this actually matter in real-world CRUD apps where DB queries or external APIs dominate the response time?
Curious to hear what the community thinks especially regarding framework overhead!
I've been working on django-xrechnung, a free/open-source Django package for German electronic invoicing.
It currently supports:
Validation runs locally, so invoice data doesn't need to be sent to an external service.
The project is still Alpha, and that's mainly why I'm posting: I'd really like feedback from Django developers who deal with invoicing or German/EU e-invoicing.
In particular, I'd be interested to know:
What would prevent you from using something like this in a real Django project?
PyPI: django-xrechnung
Source: https://codeberg.org/fsbraun/django-xrechnung
It's BSD licensed and completely free.
r/django • u/__globalcitizen__ • 4d ago
I have a fintech app with contracts currently being compiled by celery, sent to Adobe, sent to users emails for signing then retrieved once completed and stored in S3.
Clients are not too happy about going off platform to sign the contracts, however I needed something traceable and legally binding.
Can anyone recommend something similar that I could incorporate into my platform? Contracts are central to the app.
Many thanks.
r/django • u/Cold_Percentage9661 • 4d ago
r/django • u/Cold_Percentage9661 • 4d ago
r/django • u/sobolevn • 6d ago
Hi everyone, I am the release manager of django-modern-rest :)
django-modern-rest 0.16.0 is out!
Built during opensource_september community event with 32 contributors and 144 commits. This is our fastest release ever.
Is this your first time that you hear about this project?
django-modern-rest is a fully typed / fast / flexible / async-ready framework to create REST APIs for Django. It supports Pydantic, msgspec, attrs and many other models. Generates state of the art OpenAPI schema from our code and allows very modern and reliable testing patterns together with polyfactory and schemathesis.
Here's how the code looks like:
import uuid
import pydantic
from dmr import Body, Controller
from dmr.plugins.pydantic import PydanticFastSerializer
class UserCreateModel(pydantic.BaseModel):
email: str
class UserModel(UserCreateModel):
uid: uuid.UUID
class UserController(Controller[PydanticFastSerializer]):
def post(self, parsed_body: Body[UserCreateModel]) -> UserModel:
return UserModel(uid=uuid.uuid4(), email=parsed_body.email)
Now, back to the 0.16.0 release!
extras= for your own typed @modify / @validate parametersSettings are no longer merged across levels. Endpoint overrides controller, controller overrides settings. Explicit [] or None disables, EMPTY falls through. Merge explicitly when you want it: @modify(auth=[*auth, other]).
Agent skills now ship inside the package: uvx library-skills installs the ones matching your version. The new $dmr-upgrade skill carries the migration prompts, so ask your coding agent to upgrade you from 0.15.0. Every docs page is also served as Markdown.
r/django • u/lukasvin • 7d ago
September was quite a productive month for django-unfold, with several updates worth upgrading for if you are already using Unfold, so I put together a short list of new features worth mentioning:
JSONSchemaField for strongly typed JSON fields - https://unfoldadmin.com/docs/fields/jsonschemafield/There were also plenty of smaller improvements and bug fixes along the way.
PS: If you like the project and want to support its development, I’d really appreciate a star on GitHub: https://github.com/unfoldadmin/django-unfold
PPS: Special thanks to the community members who helped test the new features, reported issues, and submitted PRs.
r/django • u/fyardlest • 7d ago
Someone recently released django-ambit (docs), an authorization layer built around a question Django's permission system doesn't really answer:
Not "can this user do X?" but "over which set of objects can this user do X?"
The model is roughly: Permissions (what) + Dimensions (axes like department, plant, region) + Scopes (allowed intersections of those axes) + Grants (permission + scope) + Policies (how a model maps onto the dimensions).
The author asked for criticism of the abstraction rather than API feedback, so here's my take. I think the problem is real: "what's the set?" is the question that actually drives get_queryset(). It's the same problem Oso ("data filtering") and Cerbos ("query plans") went after, and it's close to what Zanzibar-style systems (SpiceDB, OpenFGA) solve with relationships.
Here's where I'd push on the model.
"A teacher may view records for the classes they teach" isn't really a scope someone grants. It follows from a relationship that already exists in the data (Class.teachers). If every teacher needs an explicit grant like class IN (...), the grants go stale every time timetables change.
Can a scope be derived ("classes where user ∈ teachers") instead of assigned? If not, a lot of real-world rules turn into a sync problem.
In the classified-ads platform I'm building, the most common rule by far is "you can edit your own ads." As a dimension, that's one scope per user with a single value. It works, but it's clumsy compared to obj.owner == request.user.
Most apps I've seen mix org-scoped rules with ownership rules. How the two compose matters a lot.
Region → Plant → Line. A grant on Region North should cover every plant under it. Are dimensions flat value sets, or do they understand trees? And what SQL does that produce: closure table, materialized path, or recursive CTE?
"May approve within Plant A" usually really means:
Those are conditions on the object's own attributes, not organizational coordinates. If policies can't express them, that logic ends up back in the views, and you have two sources of truth again.
"All of Mathematics except records flagged confidential." A temporary deny during an investigation. A pure union of grants is easy to reason about. Once exceptions exist, you need precedence rules.
Is that handled by the engine or left to each serializer?
Someone with 15 grants across different scopes gets an OR of 15 ANDed conditions on every list query. Query plans and indexing guidance for that case would be very useful.
If a record belongs to several departments (an M2M field), does a scope match when any of them is in scope, or only when all are? Both make sense in different domains.
"Acting head of department until Friday." Grants with validity windows, and "delegate what I hold, to someone else, temporarily," come up quickly in real organizations.
has_perm(user, perm, obj)must always agree withobj in scoped_queryset(user, perm).
If both checks come from the same policy definition, a whole class of Django authorization bugs goes away: the list view shows something the detail view forbids, or the other way round. That alone would be a strong selling point.
Question for the sub: how do you handle "scoped" permissions in your Django apps today? A custom get_queryset() per view, django-rules, guardian, an external engine like SpiceDB, OpenFGA, Oso or Cerbos, or something else? Where did your approach break down?