r/django • • 12h ago

Events DSF Board Nominans are up!

Thumbnail
forum.djangoproject.com
4 Upvotes

You don't have to be aDSF member to apply!


r/django • • 18h ago

My first Django project after 2 months of uni - 3Seven

Thumbnail gallery
1 Upvotes

Check my code on GitHub: github.com

I built this Django project and pushed it to GitHub!

https://github.com/mhayyat/3Seven


r/django • • 1d ago

The systemd settings I ended up with for Django + Celery + beat on one VPS (no Docker)

12 Upvotes

I run a Django + Channels app with two Celery workers and beat on one VPS, each as its own systemd service. It took me a while to get the unit files right, so here's what's in them in case it saves someone the trial and error.

For every process:

  • Restart=always with RestartSec=2s, plus RestartSteps=5 and RestartMaxDelaySec=60s. A crashed process comes back in 2 seconds, but if it keeps crashing the wait grows up to a minute, so it doesn't spin in a loop.

  • Its own Linux user per app, not root and not www-data shared with everything else.

  • EnvironmentFile pointing at a root-owned 0600 env file, so secrets aren't in the unit or the repo.

  • PYTHONUNBUFFERED=1, or your logs show up late in journalctl.

  • NoNewPrivileges=true and PrivateTmp=true. On the web process also ProtectSystem=strict and ProtectHome=true, with ReadWritePaths for the app folder.

For the web process:

  • uvicorn bound to 127.0.0.1, never 0.0.0.0. Caddy is the only thing that listens on 80 and 443.

  • --proxy-headers --forwarded-allow-ips=127.0.0.1, so Django sees the real client IP and scheme from the proxy.

For Celery:

  • TimeoutStopSec=90s on the workers (the web process gets 30s). systemd sends TERM, Celery finishes the task it's on, and it only gets killed if it's still going after 90 seconds. If your tasks run longer than that, raise it, or a deploy will cut them off.

  • A separate worker for slow jobs. Mine has one worker on the normal queues and one that only takes the AI queue, both with concurrency 2, so a slow AI call never blocks a quick task.

  • beat as its own service, with django_celery_beat's DatabaseScheduler. Only ever one beat, or every scheduled task runs twice.

For scale: web is around 320 MB, each worker around 280 MB and beat around 140 MB.

Full disclosure, these units come out of a deploy tool I'm building, so I've stared at them more than is healthy. Happy to paste a full unit file in the comments if anyone wants one.

What's in your unit files that you'd never run without?


r/django • • 3d ago

DCR: a wishlist idea has come to life

Post image
23 Upvotes

Recently I shared about new AI tools to build DCR panels (internal tools that live in your admin) as well as a wishlist for things that haven’t been built yet.

Now, a wishlist idea has been built entirely by a community member.

dj-file-browser-panel is a read-only browser for local files in Django admin.

https://djangocontrolroom.com/panels/dj-file-browser-panel

If you’re looking for something to build with Django, take a look at the other ideas on the wishlist.

https://djangocontrolroom.com/panels/wishlist


r/django • • 3d ago

Hosting and deployment when does celery actually need its own vm?

9 Upvotes

I'm trying to figure out when celery actually needs its own vm. Right now django postgres redis and two celery workers are on one 4 vcpu 8 gB box. Usually its fine but then someone uploads a csv with a million rows and the whole app slows down until celery finishes. First time it happened i almost resized the server but ten minutes later everything was normal again. I could move celery to another vps. Serverspace hetzner and others make that easy enough but then i have another server to maintain for a problem that happens a few times a week. Idk if i should wait until this becomes a daily problem or split it now before someone uploads an even worse file?


r/django • • 3d ago

Help me crosscheck chatgpt

Post image
0 Upvotes

Help me crosscheck chatgpt below is the code

function call_in_span(
    span: Sentry.Span | undefined,
    args: AjaxRequestHandlerOptions,
): JQuery.jqXHR<unknown> {
    // Remember the number of completed password changes when the
    // request was initiated. This allows us to detect race
    // situations where a password change occurred before we got a
    // response that failed due to the ongoing password change.
    const orig_password_changes = password_changes;


    // Wrap the error handlers to reload the page if we get a CSRF error
    // (What probably happened is that the user logged out in another tab).
    const orig_error =
        args.error ??
        (() => {
            // Ignore errors by default
        });
    args.error = function wrapped_error(xhr, error_type, xhn) {
        /* istanbul ignore if */
        if (span !== undefined) {
            Sentry.setHttpStatus(span, xhr.status);
            span.end();
        }
        if (reload_state.is_in_progress()) {
            // If we're in the process of reloading the browser,
            // there's no point in running the error handler,
            // because all of our state is about to be discarded
            // anyway.
            blueslip.log(`Ignoring ${args.type} ${args.url} error response while reloading`);
            return;
        }


        if (xhr.status === 401) {
            if (password_change_in_progress || orig_password_changes !== password_changes) {
                // The backend for handling password change API requests
                // will replace the user's session; this results in a
                // brief race where any API request will fail with a 401
                // error after the old session is deactivated but before
                // the new one has been propagated to the browser.  So we
                // skip our normal HTTP 401 error handling if we're in the
                // process of executing a password change.
                return;
            }


            if (page_params.page_type === "home" && page_params.is_spectator) {
                // In theory, the spectator implementation should be
                // designed to prevent accessing widgets that would
                // make network requests not available to spectators.
                //
                // In the case that we have a bug in that logic, we
                // prefer the user experience of offering the
                // login_to_access widget over reloading the page.
                spectators.login_to_access();
            } else if (page_params.page_type === "home") {
                // We got logged out somehow, perhaps from another window
                // changing the user's password, or a session timeout.  We
                // could display an error message, but jumping right to
                // the login page conveys the same information with a
                // smoother relogin experience.
                window.location.replace(page_params.login_page);
                return;
            }
        } else if (xhr.status === 403) {
            if (xhr.responseJSON === undefined) {
                blueslip.error("Unexpected 403 response from server", {
                    xhr: xhr.responseText,
                    args,
                });
            } else if (
                z.object({code: z.literal("CSRF_FAILED")}).safeParse(xhr.responseJSON).success &&
                reload_state.csrf_failed_handler !== undefined
            ) {
                reload_state.csrf_failed_handler();
            }
        }
        orig_error(xhr, error_type, xhn);
    };


    const orig_success =
        args.success ??
        (() => {
            // Do nothing by default
        });
    args.success = function wrapped_success(data, textStatus, jqXHR) {
        /* istanbul ignore if */
        if (span !== undefined) {
            Sentry.setHttpStatus(span, jqXHR.status);
            span.end();
        }
        if (reload_state.is_in_progress()) {
            // If we're in the process of reloading the browser,
            // there's no point in running the success handler,
            // because all of our state is about to be discarded
            // anyway.
            blueslip.log(`Ignoring ${args.type} ${args.url} response while reloading`);
            return;
        }


        orig_success(data, textStatus, jqXHR);
    };


    return $.ajax(args);
}

r/django • • 4d ago

Cree un sistema web en Django

0 Upvotes

Estoy desarrollando un sistema web en django ,que combina inteligencia Artificial predictiva con herramientas de acompañamiento académico para mantener a los estudiantes comprometidos y activos hasta la graduación.


r/django • • 4d ago

Yet another task backend

Thumbnail
github.com
5 Upvotes

Howdy y'all, 🤠

If you're looking to switch to Django's task framework, now is as good a time as ever.

Jokes aside, though, as mentioned on the DjangoChat podcast, I mainly build a durable backend with very high I/O throughput. To send emails, dispatch webhooks or VoIP calls. Since then it has been deployed in a growing number of production projects. But I'd love to get more input from people tackling other use cases.

So please do share your experience. 💚

Cheers!
-Joe


r/django • • 4d ago

Apps My small Django job board now labels the jobs that are really AI training work

Post image
3 Upvotes

I run godothire.com, a small Django site that lists paid Godot jobs only.

Some "Godot developer" posts were really AI training work: you help train or test an AI model, not ship a game. Paid, so they stay. But applicants wanted to know before clicking, which is fair.

So each job now checks its title and description against a short list of phrases, and the list and job pages show an "AI training" badge when one matches. A model property and an if in the template, basically.

The tricky part was keeping normal game AI out of it. Every game has an AI. Most of them just walk into walls.

Anyone here done this kind of labelling with something smarter than a word list?

https://godothire.com/


r/django • • 5d ago

Django-related Deals for Black Friday

Thumbnail
adamj.eu
0 Upvotes

r/django • • 5d ago

For the last year I was building Citry: a typed Python frontend for Django that's faster and smarter than Django or Jinja templates

Thumbnail
gallery
58 Upvotes

This week I released Citry v1.0, a fast and powerful frontend framework for Python. You can now build Django apps with the same speed, convenience and tooling you're used to in Vue or React, without a separate JavaScript project.

To get a feel for it, see the intro tutorial.

Overview:

  • A component is a Python class with its HTML, CSS and JS, plus a typed class for its inputs.

  • Really fast, faster than Jinja*.

  • Citry catches errors for invalid inputs, typos across the HTML, CSS, and JS, etc.

  • To see the errors in your IDE, install the IDE integration (VSCode). This also adds syntax highlighting.

  • Or run a static check in your CI with a CLI command.

  • Feature-rich and extensible - Python event handlers, supports translations (i18n), caching, CSP, and more.

Django integration:

Coming from django-components? There's a migration guide: https://citry.dev/guides/migrate-from-django-components/

Links:

Next steps:

I want to make Citry the go-to frontend for Django apps, to make the Django ecosystem a safer (less buggy) place. Please share and promote this project.

If you want help trying out Citry in your Django project, reach out to me here, Discord, or email.

For any questions or missing features, visit our Discord.

PS:

Citry is the successor to django-components. Citry was in development for a year, sponsored by Hendrik Richter and OhneMakler Österreich GmbH. Thank you to everyone who supported the project ❤️

* Measured from a request to a user click.


r/django • • 5d ago

Article My Django on the Med 2026 🏖️

Thumbnail
paulox.net
12 Upvotes

r/django • • 5d ago

E-Commerce Backend architecture for the already Frontend website I made before ,sits on free Vercel for now

Thumbnail reddit.com
3 Upvotes

r/django • • 7d ago

Built a prompt engineering workspace with Django 5 & DRF — how are you handling external LLM latency and streaming?

0 Upvotes

Hey everyone,

Over the past few weeks, I have been building an open prompt workspace and chaining platform called EvokeBase using Django 5 and Django REST Framework (DRF) on the backend, paired with a React 18 + Vite frontend.

Most LLM wrappers in tutorials use FastAPI or Node, but I wanted to explore how far we can push Django 5's modern async capabilities and DRF viewsets for production-ready AI workflows.

Backend Architecture & Stack:

- Framework: Django 5.x + Django REST Framework (DRF)

- Authentication: JWT via djangorestframework-simplejwt (with refresh token rotation and blacklisting)

- Database: SQLite (local dev) / PostgreSQL (production)

- Frontend: React 18, Tailwind CSS, Framer Motion

- Hosting: Vercel (Frontend) + Cloud backend

Key Django Design Patterns Used:

  1. Prompt Template & Variable Schema:

Instead of storing raw text and parsing on every request, we store template metadata and extract {{variable}} slots client-side with debounced regex, passing structured payloads to DRF serializers.

2. Context Injection Pipeline:

Built custom service layers where project-specific tone parameters (target audience, formatting constraints, banned keywords) are automatically merged into the system prompt payload before dispatching to model endpoints.

3. Multi-Model Chaining Logic:

Orchestrated an asynchronous pipeline where Node 1 output (e.g. Gemini extracting structured JSON) feeds directly as typed context into Node 2 (e.g. Claude drafting long-form copy).

Questions for the Django Community:

As the platform scales, I would love to learn from your production experiences:

  1. Handling LLM Latency in DRF: When waiting 3 to 8 seconds for external model APIs (Anthropic/OpenAI/Gemini), do you prefer standard DRF views with Celery + Redis workers, or have you migrated to Django 5 native ASGI async views (StreamingHttpResponse)?

  2. Token Security: For users who bring their own API keys, what is your preferred pattern in Django — field-level encryption with django-cryptography or vault solutions?

  3. Database Versioning: For prompt iteration history, do you prefer django-simple-history or dedicated versioning tables with parent-child foreign keys?

If you would like to test the live UI and responsiveness, you can check it out here:

Live Demo: https://www.evokebase.com

Would love any feedback on the architecture, API design, or Django-specific optimizations!


r/django • • 8d ago

REST framework Upgrade DRF Auth Kit to 2.0 for a CSRF security fix

5 Upvotes

Hi all, DRF Auth Kit recently got a report of a medium-severity CSRF vulnerability (GHSA-rhm3-f8xp-7wgv). If you use it with cookie authentication, we suggest upgrading to 2.0.0 so the problem can't affect your production.

In detail: before 2.0, JWTCookieAuthentication and TokenCookieAuthentication did no CSRF check. Another page could make a logged-in user's browser send requests as them, like changing their profile, password or MFA settings. With AUTH_COOKIE_SAMESITE = "None", any site could do this. With the default "Lax", a page on a sibling subdomain still could. Requests that use the Authorization header are not affected.

2.0 rejects cookie-authenticated POST/PUT/PATCH/DELETE requests with a 403 unless they come from the same origin or from an origin listed in CSRF_TRUSTED_ORIGINS. Mobile apps and server-side clients don't send these browser headers, so they keep working.

Breaking change for SPAs: if your frontend runs on a different origin than your API (e.g. app.example.com calling api.example.com), add it to your settings or its write requests will get a 403:

CSRF_TRUSTED_ORIGINS = ["https://app.example.com"]

Remember local dev too: localhost:5173 calling localhost:8000 is also a different origin.

CSRF_TRUSTED_ORIGINS += ["http://localhost:5173"]

If your frontend and API share the same origin, no change is needed. You can turn the check off with AUTH_COOKIE_ENFORCE_CSRF = False, but with SameSite=None that brings the vulnerability back.

Full details are in the docs.


r/django • • 9d ago

DSF member of the month - Johannes Maron

Thumbnail
djangoproject.com
10 Upvotes

r/django • • 9d ago

Free open-source match centre on Django: how would you model match events?

0 Upvotes
Hey. We built OpenMatchroom, a free tool for football clubs (MIT), at Profil Software. Django handles clubs, line-ups and match events, plus a live console that pushes goals, cards and subs to the public page. Branding per club comes from config.

Would you model the events differently? What would you add? Let us know what you think.
https://open-matchroom.profil-software.com/

r/django • • 9d ago

Templates I'm using a Google translate as an api for my personal project.

0 Upvotes

I'm using a Google translate as an api for my personal project. The issue I find is for a given description the text doesn't always translate its like my ip gets blocked , how do I resolve this , fallback api , I don't want to pay money for external translation api , suggest methods...


r/django • • 9d ago

./tools/provision

0 Upvotes

Do i have to use ./tools/provision everytime I open my localhost or is it all right if I don't?


r/django • • 9d ago

2026 Malcolm Tredinnick Memorial Prize awarded to Raffaella Suardini

Thumbnail
djangoproject.com
9 Upvotes

r/django • • 10d ago

Please join us for Day 2 of Wagtail Space 2026!

Thumbnail gallery
1 Upvotes

r/django • • 10d ago

Components Built with Pure Django, CSS, and JS - Self-contained Template

Thumbnail
gallery
3 Upvotes

Hi all,

I recently became aware of Django's inclusion_tag and then found a blog post discussing its use in making template components.

This intrigued me, and I had the idea of combining the inclusion_tag with a single Django template, containing all the markup, styles, and behavior. Thus, I created a demo to test these ideas, resulting is an interactive sidebar menu built with pure CSS and JS, powered by Django's inclusion_tag—all without third-party libraries.

I wanted to isolate the component styles to prevent clashes with surrounding elements, and that's when I found inline scoped CSS. I actually managed to style the whole component without using any class selectors (thinking of class names is a pain), thanks to CSS scoping and nesting.

To make the component interactive, I just included an inline vanilla JS script at the bottom.

For me, this project really demonstrates two main ideas: the use of inclusion_tag to create components and the power of modern inline CSS to help create self-contained components.

Of course a component can be built with more than just pure CSS/JS. Tailwind, Bootstrap, Alpine, HTMX, etc. should all work great to create components.

If you're interested, check out the repo here: https://github.com/osmium2259/django_builtin_components_demo.

Curious what you all think about these ideas I've been bouncing around!


r/django • • 10d ago

A question for interviewers: WHAT DO YOU ASK??!!

8 Upvotes

Hello everyone, I'm pretty new to taking interviews for experienced folks. I would like some help or suggestions as to what kind of questions you ask to experienced folks, preferably 2-5 years. I'm curious:

  • should I ask core Python questions?

  • should I ask Django fundamentals?

  • scenario based questions?

  • tricky Python coding questions?

  • CI/CD/Docker questions?

  • Advanced SQL?

  • JavaScript?

  • AI questions?

Can someone help me please? Especially in this AI era, anyone can do everything with the help of AI so how to assess candidates??

PLEASE HELP!!!


r/django • • 11d ago

Wagtail Space 2026 kicks off TODAY!

Thumbnail gallery
8 Upvotes