#๐Ÿ”’ Best practices for setting up a Django project for team collaboration (linting, formatting, commit

16 messages ยท Page 1 of 1 (latest)

manic drift
#

Hey everyone! I'm setting up a Django backend for a mobile app (called Seendr โ€” a friendship/social app). This will be a team project, so I want to get the developer tooling right from the start.

I'm coming from a JavaScript/React Native background where we use ESLint + Prettier to enforce code style. I want the equivalent setup for our Django project.

Here's what I think I need, but I'd love guidance on what's actually worth setting up vs. overkill:

  1. Linter โ€” I've seen flake8 and ruff mentioned. Which do you recommend for a new project in 2026?
  2. Formatter โ€” black seems to be the standard? Is ruff format a good alternative?
  3. Import sorting โ€” isort or does ruff handle this too?
  4. Type checking โ€” Is mypy worth adding from the start for a Django project?
  5. Pre-commit hooks โ€” I want to enforce all of the above automatically before commits. I assume pre-commit is the way to go?
  6. Django-specific tooling โ€” Anything like django-stubs, django-extensions, or django-debug-toolbar that you'd consider essential from day one?

Am I on the right track? Anything I'm missing or overcomplicating? Would appreciate hearing what setups you use for team Django projects.

Thanks!

wild fernBOT
#

@manic drift

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hearty lintel
#

Yes, ruff sorts imports: https://stackoverflow.com/questions/77876253 . It does a lot of things; some people like all-in-one tools, others (like myself) prefer to put stuff together.

For type-checking, if you use ruff, you may also be interested in ty by the same people.

You never really need anything, but teams will have their own ideas about how they want your dev environment set up, and that often makes coordination easier.

pre-commit is pretty standard, yes.

None of that is Django-specific.

django-stubs is something you set up so that the type checker knows Django type signatures; if you use type checking extensively (I don't) then that seems pretty essential. For the other things, read the documentation first; I would only "consider something essential from day one" if the value is clear from that.

#

A lot of this is going to depend on your team size and your role on that team. It's worlds different if you're trying to coordinate with a friend on an idea you had, vs. if you just got hired and are being onboarded.

manic drift
#

Ok I see thanks. So what will you recommend? It's just me and a friend of mine

hearty lintel
#

Honestly I would just start developing and figure out what the pain points are. But I say that because I'm already experienced with Python. If you want hand-holding on style issues then at least grab a linter and formatter first, and maybe a type checker. Ruff probably makes life simpler for you if you don't already have opinions about these kinds of things.

manic drift
#

Oh ok thank you very much. I was blocked on this part for the whole day. i just wanted to make sure I follow best practice but I an see it varies so I'll do what's required for now. Thanks for the help

hearty lintel
#

My golden rule: If there were an obvious choice, nobody would be using the other ones.

#

(and therefore you wouldn't have heard of them)

manic drift
#

I'lll kep that in mind as I embark on this python path

hearty lintel
#

o7

manic drift
#

o7?

hearty lintel
#

๐Ÿซก

manic drift
#

!close

wild fernBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.