Skip to main content

Julia Evans

31 comments on "Some notes on starting to use Django"

Comments are closed.
kucharczyk

@b0rk I've started using Django 2 years ago and since then I've definitely outgrown the ORM and feel like it's a newbie trap for only the most basic of tasks. I wish I had went with something else.

0
b0rk
Reply to kucharczyk

@kucharczyk what about it feels like a trap to you? would be interested to hear examples of things that didn’t work well for you

0
kucharczyk
Reply to b0rk

@b0rk First, the syntax gets quite convoluted past a certain point I have the feeling like directly writing SQL might be easier then. Second, ORM models tables as they are in the database but you might need to model a specific thing instead (e.g. a piece of hardware for an e-shop that is actually spread over 3 different tables in the database). What feels like a newbie trap is that it seems easier at the beginning but hard/impossible later when your needs evolve.

1
gsilvapt

@b0rk the Django ORM is definitely a productivity hack when it comes to building sites with it. It’s not perfect when you need more complex queries, like when you have M2M relationships, it needs some attention and care. Most is very well documented - so read it! 😛
Oh, same with the admin. If you use django-debug-toolbar, which shows a lot of performance and db-related metrics, you’ll see a bunch of inefficiencies around, like issuing two counts (top and bottom of the table) on the same table. I guess you could rewrite the admin templates if whatever you’re doing is Django admin intensive 🙂

0
wlonk

@b0rk This is great! Thanks for writing it!

I’ve used Django for a very long time and sadly been away from it for a while now. This post feels entirely accurate to me and makes me miss using it!

1
adama

@b0rk This was really interesting to read, thanks for sharing your experience! I'm building a small app with Flask for the first time, and feeling similarly to you about some of the built-in stuff, sqlite, ORM, email, CSRF, etc.

0
konsonantenboy

@b0rk Tip: `./manage.py check` will tell you right away if there’s anything wrong with the code.
Have fun with Django!

1
dozymoe

@b0rk with additional modules you should be able to export the website content as static website

0
mb21
Reply to dozymoe

@dozymoe @b0rk Cool, how do you specify paths for routes with parameters?
btw. this pushed me to finally publish this blog post: mastrojs.github.io/blog/2026-0

0
b0rk
Reply to dozymoe

@dozymoe interesting, what have you used that for?

0
dozymoe
Reply to b0rk

@b0rk it is personal blog and also a local middle school's website

for generating static website I think there are two types, one that uses cron and export the whole content every single time, and one where some static files are regenerated when there is content update

1
FunkyBob

@b0rk So great that Django now has "init_command" for DBs, making it much easier to set `journal_mode=WAL` for sqlite and really make it viable for small production uses.

Your comments on settings reminds me of a plan at some stage to "register" settings names to help with checking...

1
petard

@b0rk django needs a zine! Seriously, I think covering how you grow a project from a start with nanodjango (github.com/radiac/nanodjango) into a more traditionally structured project into into a site you host on a VPS for people to come use would be pretty damn cool.

0
b0rk
Reply to petard

@petard i tried evolving a project from nanodjango into a traditionally structured project and I thought it was a really cool idea but it didn't go that well for me, the nanodjango convert tool seems to have some limits so it just crashed on my project. I don't really know what happened because I just gave up and converted it manually

0
petard
Reply to b0rk

@b0rk You know, the two times I've converted them it's worked fine for me, but 4 or 5 other times I haven't even tried to convert them, because I learned something from my attempt with nanodjango that just made me restructure things so much, I wanted to start fresh anyway. I guess I like the idea of converting them more than I like the way it works out in practice.

0
petard
Reply to petard

@b0rk But I really like the idea of starting in a single file and growing into a more conventional project for some reason anyway.

0
b0rk
Reply to petard

@petard yeah, I think it helped me even though the convert process didn't actually work and I might even use it again

0
radiac
Reply to b0rk

@b0rk @petard I'm the author of nanodjango, great to hear you found it useful! The convert process involves lots of pretty hairy AST manipulation, so there are going to be some edge cases it struggles with, and it's not always going to get things right, but I am aiming to cover as much as possible, and make it fail gracefully and still be helpful. I'm always interested to see examples of where it goes wrong so I can improve things - please do drop code samples into GitHub issues if you can!

0
anton

@b0rk welcome to the fabulous world of Django! :)

1
christianmlong

@b0rk I like the pytest-django library. It lets me write my Django tests in a pytest style.

1
tykling

@b0rk very nice :D looking forward to the #django version of MessWIthDNS! :P

0
jdboyd

@b0rk The Django admin system is the big reason I prefer using Django for any applicable web projects. I haven't moved anything to use it yet, but I'm hoping that the new background task system will prove equally indispensable.

1
sahil

@b0rk If you ever need auth I would recommend: docs.allauth.org/en/latest/

Also a nice starter: github.com/cookiecutter/cookie

0
b0rk
Reply to sahil

@sahil thanks!

1
adamghill

@b0rk related to jvns.ca/blog/2026/01/27/some-n: I also don't love the lack of documentation for Django's settings in the IDE.

So, I threw together a little VS Code extension which gives more context for all of Django's settings. Not sure how easy it is to make it a LSP, though.

1
josh
Reply to adamghill

@adamghill @b0rk for the out of the box settings it’s not so bad, when you throw in any third party deps and how they use settings, well…

0
josh
Reply to josh

@adamghill @b0rk on top of so much Django being dependent on the runtime dynamic nature of Python, hard for any general type checker / LSP. IIRC ty has plans to purpose build some things for Django directly into the tool to help, but there’s a reason why it’s still not a solved problem

0
tncowart

@b0rk I prefer django to rails for many of the same reasons! Having to be moe explicit helps jumping around the code in code editors, too. The ORM is so good. Regarding performance, Ive been able to solve most problems with prefech_related or select_related.

1
willywongi

@b0rk I recently started a blog about Python and Django and I think you can find some perspectives about settings py file (it can be a py module), debugging email (use MailCrab!) and sending HTML email (MJML is involved). pongi.it/posts/mjml/

0
varx

RE: social.jvns.ca/@b0rk/115969229

@b0rk One note on the auto-generated migrations -- it's a good idea to use the `sqlmigrate` management command to view the actual SQL that will be emitted. Sometimes the SQL is not what you expect, and can have performance issues or worse!

It's also good to check whether the migration is reversible. I can't remember how to do that, and haven't found docs in a quick search, but something to keep in mind.

(All of this is less of an issue in a low-stakes deployment where you can just back up and restore a sqlite file, of course.)

0
varx
Reply to varx

@b0rk ...how did this end up as a quote-toot? I am apparently not very good with mastodon.