mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-07 13:34:53 +03:00
Post-gen gitignore .env/ and .env
This commit is contained in:
parent
4367e5a09d
commit
4f3ec4ddca
|
@ -202,6 +202,15 @@ def remove_open_source_files():
|
||||||
PROJECT_DIRECTORY, filename
|
PROJECT_DIRECTORY, filename
|
||||||
))
|
))
|
||||||
|
|
||||||
|
def append_to_gitignore(path):
|
||||||
|
"""
|
||||||
|
Append path to `.gitignore`.
|
||||||
|
|
||||||
|
:param path: File/dir path to append.
|
||||||
|
"""
|
||||||
|
gitignore_file_path = os.path.join(PROJECT_DIRECTORY, '.gitignore')
|
||||||
|
with open(gitignore_file_path, 'a') as gitignore_file:
|
||||||
|
gitignore_file.write(path)
|
||||||
|
|
||||||
# IN PROGRESS
|
# IN PROGRESS
|
||||||
# def copy_doc_files(project_directory):
|
# def copy_doc_files(project_directory):
|
||||||
|
@ -271,3 +280,11 @@ if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
|
||||||
# Remove files conventional to opensource projects only.
|
# Remove files conventional to opensource projects only.
|
||||||
if '{{ cookiecutter.open_source_license }}' == 'Not open source':
|
if '{{ cookiecutter.open_source_license }}' == 'Not open source':
|
||||||
remove_open_source_files()
|
remove_open_source_files()
|
||||||
|
|
||||||
|
# Append `.env/` to the generated project's `.gitignore`.
|
||||||
|
dotenv_dir_path = '.env/'
|
||||||
|
append_to_gitignore(dotenv_dir_path)
|
||||||
|
|
||||||
|
# Append `.env` to the generated project's `.gitignore`.
|
||||||
|
dotenv_dir_path = '.env'
|
||||||
|
append_to_gitignore(dotenv_dir_path)
|
||||||
|
|
2
{{cookiecutter.project_slug}}/.gitignore
vendored
2
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -66,9 +66,7 @@ target/
|
||||||
celerybeat-schedule
|
celerybeat-schedule
|
||||||
|
|
||||||
# Environments
|
# Environments
|
||||||
.env
|
|
||||||
.venv
|
.venv
|
||||||
env/
|
|
||||||
venv/
|
venv/
|
||||||
ENV/
|
ENV/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user