- Django 3 Web Development Cookbook
- Aidas Bendoraitis Jake Kronika
- 112字
- 2025-04-04 13:15:07
How it works...
The .gitignore file specifies patterns that should intentionally be untracked by the ?Git version control system. The .gitignore file that we created in this recipe will ignore the Python-compiled files, local settings, collected static files, ?and media directory with the uploaded files.
Note that we have exceptional syntax with exclamation marks for media and static files:
/media/
!/media/.gitkeep
This tells Git to ignore the /media/ directory but keep the /media/.gitkeep file tracked under version control. As Git version control tracks files, but not directories, we use .gitkeep to make sure that the media directory will be created in each environment, but not tracked.