user2361174
user2361174

Reputation: 1942

What files/directories belong in a django repo?

So I have been working with a Django tutorial on a Windows Machine and now I'm trying to push that code onto Github. This is what my upper level directories look like:

Envs/
    myproject/
        Include/
            ...
        Lib/
            ...
        Scripts/
            ...
        tcl/
            ...
        pip-selfcheck.json
    mysite/
        polls/
            ...
        mysite/
            ...
        db.sqlite3
        manage.py

What directories should I be adding to the repo so that I could pull the repo from another Django-installed machine and be able to run the code? Which directory should be the root for my repo?

Upvotes: 1

Views: 461

Answers (3)

bruno desthuilliers
bruno desthuilliers

Reputation: 77942

The answer is not really Django (nor even Python) specific - nor specific to git or github FWIW. The rule is: your source files and assets (icons, images, fixtures, requirements files, installation scripts etc) belong to the repo. Everything that is either installed / compiled / generated by your installation scripts or is "user content" (databases, user uploaded/user generated files etc) should stay out of the repo and actually out of your project's root.

For a more Django specific answer, your virtualenv, database (if using sqlite or any other file-based db), MEDIA_ROOT and STATIC_ROOT (the first storing user generated content and the second collected project's and apps static assets) should be left out of both your repo and your project's root.

Upvotes: 0

pedrorijo91
pedrorijo91

Reputation: 7865

Github contains a set of gitignore files at https://github.com/github/gitignore. Have a look at the python one which includes django stuff https://github.com/github/gitignore/blob/master/Python.gitignore#L53

also, about gitignore: https://git-scm.com/docs/gitignore

Upvotes: 1

doniyor
doniyor

Reputation: 37934

everything that is inside mysite/

virtualenv things dont belong to github.

Upvotes: 2

Related Questions