Maciaz
Maciaz

Reputation: 1224

Python Django project - What to include in code repository?

I'd like to know whether I should add below files to the code repository:

manage.py
requirements.txt

Also created the very core of the application that includes settings.py. Should that be added to the repo?

And the last one. After creating a project, a whole .idea/ folder was created. It was not included in the .gitignore file template, so how about that?

Upvotes: 0

Views: 741

Answers (1)

Eric Turner
Eric Turner

Reputation: 133

manage.py

This is part of the Django package, so you do not need to include it. Anyone who install's django will have that installed with it.

requirements.txt

This is how you actually how you tell people WHAT to install to run your project. So at the very least, for a Django project, you will want Django to be in that file. So yes, this file should be included in your git repo. Then anyone you pulls your code can simple run pip install -r requirements.txt and have the requirements installed.

settings.py

This is where things get slightly more into personal preference, but in general, yes it (or something like it) should be included. I like to follow the "Two Scoops of Django" pattern (https://startcodingnow.com/two-scoops-django-config/) of having different settings for different environments.

.idea/

This is actually IDE specific information. JetBrains has a sample file for what they recommend ignoring and what they think you should keep in that folder (https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore), but I think it is far more common to just completely ignore that folder all together.

Upvotes: 2

Related Questions