mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-02 11:10:12 +03:00
Post hook cleanup
This commit is contained in:
parent
ce8a711cf6
commit
fb65b03a45
|
@ -22,5 +22,5 @@
|
|||
"js_task_runner": ["Gulp", "Grunt", "None"],
|
||||
"use_lets_encrypt": "n",
|
||||
"open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"],
|
||||
"use_elasticbeanstalk": "y"
|
||||
"use_elasticbeanstalk_experimental": "y"
|
||||
}
|
||||
|
|
|
@ -115,7 +115,10 @@ def remove_heroku_files():
|
|||
"""
|
||||
Removes files needed for heroku if it isn't going to be used
|
||||
"""
|
||||
for filename in ["app.json", "Procfile", "requirements.txt", "runtime.txt"]:
|
||||
filenames = ["app.json", "Procfile", "runtime.txt"]
|
||||
if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
|
||||
filenames.append("requirements.txt")
|
||||
for filename in ["app.json", "Procfile", "runtime.txt"]:
|
||||
file_name = os.path.join(PROJECT_DIRECTORY, filename)
|
||||
remove_file(file_name)
|
||||
|
||||
|
@ -179,6 +182,22 @@ def remove_copying_files():
|
|||
PROJECT_DIRECTORY, filename
|
||||
))
|
||||
|
||||
def remove_elasticbeanstalk():
|
||||
"""
|
||||
Removes elastic beanstalk components
|
||||
"""
|
||||
docs_dir_location = os.path.join(PROJECT_DIRECTORY, '.ebextensions')
|
||||
if os.path.exists(docs_dir_location):
|
||||
shutil.rmtree(docs_dir_location)
|
||||
|
||||
filenames = ["ebsetenv.py", ]
|
||||
if '{{ cookiecutter.use_heroku }}'.lower() != 'y':
|
||||
filenames.append("requirements.txt")
|
||||
for filename in filenames:
|
||||
os.remove(os.path.join(
|
||||
PROJECT_DIRECTORY, filename
|
||||
))
|
||||
|
||||
# IN PROGRESS
|
||||
# def copy_doc_files(project_directory):
|
||||
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
|
||||
|
@ -258,5 +277,6 @@ if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use
|
|||
if '{{ cookiecutter.open_source_license}}' != 'GPLv3':
|
||||
remove_copying_files()
|
||||
|
||||
# 4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/
|
||||
# copy_doc_files(PROJECT_DIRECTORY)
|
||||
# 12. Remove Elastic Beanstalk files
|
||||
if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
|
||||
remove_elasticbeanstalk()
|
||||
|
|
|
@ -138,7 +138,7 @@ See detailed `cookiecutter-django Docker documentation`_.
|
|||
|
||||
.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html
|
||||
{% endif %}
|
||||
{% if cookiecutter.use_elasticbeanstalk %}
|
||||
{% if cookiecutter.use_elasticbeanstalk_experimental %}
|
||||
|
||||
Elastic Beanstalk
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -177,7 +177,7 @@ TEMPLATES[0]['OPTIONS']['loaders'] = [
|
|||
|
||||
# DATABASE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
{% if cookiecutter.use_elasticbeanstalk -%}
|
||||
{% if cookiecutter.use_elasticbeanstalk_experimental -%}
|
||||
# Uses Amazon RDS for database hosting, which doesn't follow the Heroku-style spec
|
||||
DATABASES = {
|
||||
'default': {
|
||||
|
@ -197,7 +197,7 @@ DATABASES['default'] = env.db('DATABASE_URL')
|
|||
|
||||
# CACHING
|
||||
# ------------------------------------------------------------------------------
|
||||
{% if cookiecutter.use_elasticbeanstalk -%}
|
||||
{% if cookiecutter.use_elasticbeanstalk_experimental -%}
|
||||
REDIS_LOCATION = "redis://{}:{}/0".format(
|
||||
env('REDIS_ENDPOINT_ADDRESS'),
|
||||
env('REDIS_PORT')
|
||||
|
|
Loading…
Reference in New Issue
Block a user