[Fixed]-What should be in gitignore, and how do I put env folder to gitignore and is my folder structure correct?

25👍

Your env folder should be in the gitignore, but it doesn’t have to be in your project folder.
You can put everything you want in your gitignore.

For example :

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
db.sqlite3
migrations/
media/
settings.py
# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

Your folder structure seems good, I would add some directories in it, to optimize your code and general architecture, mine looks like that, and that’s pretty awesome, but you can do what you want for all your project :

project/
---project/
---app1/
---app2/
------migrations/
------url/
---------__init__.py
---------url1.py
---------url2.py
------views/
---------__init__.py
---------view1.py
---------view2.py
------forms/
---------__init__.py
---------form1.py
------models/
---------__init__.py
---------model1.py
---------model2.py
---app3/
---static/
---templates/
------app1/
------app2/
---------view1/
-------------home.html
---------layout.html
------app3/
---templatetags/
---manage.py

This project structure allows you to separate the different templates of all your app, better to modify them quickly and easily. It allows you to have a refactored code inside each app, it permits to prevent future code error (4000 codes lines in files comes really quickly so be careful!).

You also can have separate folders for all your statics and templatetags, so you can use it everywhere in your templates, pretty awesome !

Remember, you can do everything you want with your folder structure, the best you can do is the best that fits you 🙂

Hope it helps !

5👍

Your virtualenv folder can be completely outside your tracked folder. Just add requirements.txt in it.

👤loutre

Leave a comment