创建.gitignore文件
- 安装git
- 然后直接创建一个名字.gitignore的文件
Django项目建议忽略的文件清单
一般缓存文件__pycache__和本地日志文件.log不需要提交。media文件夹和db.sqlite3文件可能包括了本地测试数据和文件,也不要提交。PyCharm生成的文件, Env文件第三方package也不要提交。下列文件和文件夹建议忽略。
Django
*.log
*.pot
*.pyc
pycache
db.sqlite3
media
Backup files
*.bak
If you are using PyCharm
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/gradle.xml
.idea/**/libraries
*.iws /out/
Python
*.py[cod]
*$py.class
Distribution / packaging
.Python build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
*.manifest
*.spec
Installer logs
pip-log.txt
pip-delete-this-directory.txt
Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache/
nosetests.xml
coverage.xml
*.cover
.hypothesis/
pyenv
.python-version
celery
celerybeat-schedule.*
SageMath parsed files
*.sage.py
Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
mkdocs documentation
/site
mypy
.mypy_cache/
Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
sftp configuration file
sftp-config.json
Package control specific files Package
Control.last-run
Control.ca-list
Control.ca-bundle
Control.system-ca-bundle
GitHub.sublime-settings
Django数据库迁移文件是否需要上传
- 处于开发状态,可以进行上传
- 处于生产环境,需要上传
- 大多数情况之下,都进行上传迁移文件,不要进行忽略,如果发生冲突,使用python manage.py makemigrations --merges合并冲突