.django 中的 gitignore 文件

问题描述 投票:0回答:2

我应该在 github 上的 django/redis 和 python 中推送我的小项目,但我注意到在创建一些用户并进行推送后,它们也保存在 github 上。在互联网上阅读我应该创建一个 gitignore 文件,但我不知道在里面写什么。 显然我应该保存迁移,但不保存已输入数据库的数据。 我在 gitignore.io 上找到了一个文件,但我不确定其中的所有内容是否适合我的情况。你有什么提示或网站可以让我检查吗?

django github gitignore
2个回答
1
投票

这就是我为我的一个基于 Django 构建并使用 Redis 服务器进行缓存管理的项目编写 .gitignore 的方式。我希望它可以帮助您了解可能需要添加的内容。

venv/
    .env
    __pycache__
    .vscode/
    static_cdn/
    media/*
    ### Python template
    # Byte-compiled / optimized / DLL files
    __pycache__/
    *.py[cod]
    *$py.class
    
    # C extensions
    *.so
    
    # Distribution / packaging
    .Python
    env/
    build/
    develop-eggs/
    dist/
    downloads/
    eggs/
    .eggs/
    lib/
    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
    .hypothesis/
    
    # Translations
    *.mo
    *.pot
    
    # Django stuff:
    *.log
    local_settings.py
    
    # Flask stuff:
    instance/
    .webassets-cache
    
    # Scrapy stuff:
    .scrapy
    
    # Sphinx documentation
    docs/_build/
    
    # PyBuilder
    target/
    
    # IPython Notebook
    .ipynb_checkpoints
    
    # pyenv
    .python-version
    
    # celery beat schedule file
    celerybeat-schedule
    
    
    
    # Spyder project settings
    .spyderproject
    
    # Rope project settings
    .ropeproject
    
    db.sqlite3

0
投票
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
*.manifest
*.spec

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

# Python environments
.env
venv/
ENV/
env/
env.bak/
venv.balk/
.pytest_cache/
celerybeat-schedule
# Environments directory previously was included twice in different formats

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

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
# Recommended to ignore production_settings.py if exists
production_settings.py
db.sqlite3
db.sqlite3-journal
/media/
# Including trailing slash for directories like 'media' makes its purpose clearer

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# Project metadata and packaging
target/
.pipenv.lock
Pipfile.lock
poetry.lock
pyproject.toml

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy cache
.mypybeautiful/

# Editor configurations
.vscode/
.idea/
*.sublime-workspace
*.sublime-project

# Operating system files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
© www.soinside.com 2019 - 2024. All rights reserved.