Updates settings and generation

This commit is contained in:
Corey Oordt 2019-07-23 08:42:29 -05:00
parent 5507dfe4f9
commit e89f611238
10 changed files with 43 additions and 40 deletions

View File

@ -13,5 +13,6 @@ pin: True
requirements: requirements:
- "requirements.txt" - "requirements.txt"
- "{{cookiecutter.project_slug}}/requirements/base.txt" - "{{cookiecutter.project_slug}}/requirements/base.txt"
- "{{cookiecutter.project_slug}}/requirements/local.txt" - "{{cookiecutter.project_slug}}/requirements/dev.txt"
- "{{cookiecutter.project_slug}}/requirements/production.txt" - "{{cookiecutter.project_slug}}/requirements/production.txt"
- "{{cookiecutter.project_slug}}/requirements/test.txt"

View File

@ -212,7 +212,6 @@ def set_flags_in_envs(postgres_user, celery_flower_user, debug=False):
local_django_envs_path = os.path.join(".envs", "dev", "django") local_django_envs_path = os.path.join(".envs", "dev", "django")
production_django_envs_path = os.path.join(".envs", "prod", "django") production_django_envs_path = os.path.join(".envs", "prod", "django")
local_postgres_envs_path = os.path.join(".envs", "dev", "postgres") local_postgres_envs_path = os.path.join(".envs", "dev", "postgres")
production_postgres_envs_path = os.path.join(".envs", "prod", "postgres")
set_django_secret_key(production_django_envs_path) set_django_secret_key(production_django_envs_path)
set_django_admin_url(production_django_envs_path) set_django_admin_url(production_django_envs_path)
@ -221,10 +220,6 @@ def set_flags_in_envs(postgres_user, celery_flower_user, debug=False):
set_postgres_password( set_postgres_password(
local_postgres_envs_path, value=DEBUG_VALUE if debug else None local_postgres_envs_path, value=DEBUG_VALUE if debug else None
) )
set_postgres_user(production_postgres_envs_path, value=postgres_user)
set_postgres_password(
production_postgres_envs_path, value=DEBUG_VALUE if debug else None
)
set_celery_flower_user(local_django_envs_path, value=celery_flower_user) set_celery_flower_user(local_django_envs_path, value=celery_flower_user)
set_celery_flower_password( set_celery_flower_password(
@ -250,10 +245,18 @@ def remove_envs_and_associated_files():
os.remove(os.path.join("bin", "merge_production_dotenvs_in_dotenv.py")) os.remove(os.path.join("bin", "merge_production_dotenvs_in_dotenv.py"))
def create_dev_settings():
shutil.copy(
os.path.join("{{ cookiecutter.project_slug }}", "settings", "dev_template.py"),
os.path.join("{{ cookiecutter.project_slug }}", "settings", "dev.py"),
)
def main(): def main():
set_flags_in_envs(generate_random_user(), generate_random_user()) set_flags_in_envs(generate_random_user(), generate_random_user())
set_flags_in_settings_files() set_flags_in_settings_files()
create_dev_settings()
if "{{ cookiecutter.open_source_license }}" == "Not open source": if "{{ cookiecutter.open_source_license }}" == "Not open source":
remove_open_source_files() remove_open_source_files()

View File

@ -12,6 +12,6 @@ language: python
python: python:
- "3.6" - "3.6"
install: install:
- pip install -r requirements/local.txt - pip install -r requirements/test.txt
script: script:
- "pytest" - "pytest"

View File

@ -40,12 +40,11 @@ services:
image: mailhog/mailhog:v1.0.0 image: mailhog/mailhog:v1.0.0
ports: ports:
- "8025:8025" - "8025:8025"
{%- endif %} {%- endif %}
{%- if cookiecutter.use_celery == 'y' %}
redis: redis:
image: redis:5.0 image: redis:5.0
{%- if cookiecutter.use_celery == 'y' %}
celeryworker: celeryworker:
<<: *django <<: *django

View File

@ -3,7 +3,7 @@ import os
import sys import sys
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ cookiecutter.project_slug }}.settings")
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line

View File

@ -21,7 +21,6 @@ django==2.2.3 # pyup: < 3.0 # https://www.djangoproject.com/
django-environ==0.4.5 # https://github.com/joke2k/django-environ django-environ==0.4.5 # https://github.com/joke2k/django-environ
django-model-utils==3.2.0 # https://github.com/jazzband/django-model-utils django-model-utils==3.2.0 # https://github.com/jazzband/django-model-utils
django-allauth==0.39.1 # https://github.com/pennersr/django-allauth django-allauth==0.39.1 # https://github.com/pennersr/django-allauth
django-crispy-forms==1.7.2 # https://github.com/django-crispy-forms/django-crispy-forms
{%- if cookiecutter.use_compressor == "y" %} {%- if cookiecutter.use_compressor == "y" %}
django-compressor==2.3 # https://github.com/django-compressor/django-compressor django-compressor==2.3 # https://github.com/django-compressor/django-compressor
{%- endif %} {%- endif %}

View File

@ -1,31 +1,8 @@
-r ./base.txt -r ./base.txt
-r ./test.txt
Werkzeug==0.14.1 # pyup: < 0.15 # https://github.com/pallets/werkzeug Werkzeug==0.14.1 # pyup: < 0.15 # https://github.com/pallets/werkzeug
ipdb==0.12 # https://github.com/gotcha/ipdb ipdb==0.12 # https://github.com/gotcha/ipdb
Sphinx==2.1.2 # https://github.com/sphinx-doc/sphinx
psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2 psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2
# Testing
# ------------------------------------------------------------------------------
mypy==0.720 # https://github.com/python/mypy
pytest==5.0.1 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
# Code quality
# ------------------------------------------------------------------------------
flake8==3.7.8 # https://github.com/PyCQA/flake8
coverage==4.5.3 # https://github.com/nedbat/coveragepy
black==19.3b0 # https://github.com/ambv/black
pylint-django==2.0.11 # https://github.com/PyCQA/pylint-django
{%- if cookiecutter.use_celery == 'y' %}
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
{%- endif %}
# Django
# ------------------------------------------------------------------------------
factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy
django-debug-toolbar==2.0 # https://github.com/jazzband/django-debug-toolbar django-debug-toolbar==2.0 # https://github.com/jazzband/django-debug-toolbar
django-extensions==2.1.9 # https://github.com/django-extensions/django-extensions django-extensions==2.1.9 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django==3.5.1 # https://github.com/pytest-dev/pytest-django

View File

@ -4,9 +4,6 @@
gunicorn==19.9.0 # https://github.com/benoitc/gunicorn gunicorn==19.9.0 # https://github.com/benoitc/gunicorn
psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2
{%- if cookiecutter.use_whitenoise == 'n' %}
Collectfast==0.6.2 # https://github.com/antonagestam/collectfast
{%- endif %}
{%- if cookiecutter.use_sentry == "y" %} {%- if cookiecutter.use_sentry == "y" %}
sentry-sdk==0.10.2 # https://github.com/getsentry/sentry-python sentry-sdk==0.10.2 # https://github.com/getsentry/sentry-python
{%- endif %} {%- endif %}
@ -17,5 +14,7 @@ sentry-sdk==0.10.2 # https://github.com/getsentry/sentry-python
django-storages[boto3]==1.7.1 # https://github.com/jschneier/django-storages django-storages[boto3]==1.7.1 # https://github.com/jschneier/django-storages
{%- elif cookiecutter.cloud_provider == 'GCP' %} {%- elif cookiecutter.cloud_provider == 'GCP' %}
django-storages[google]==1.7.1 # https://github.com/jschneier/django-storages django-storages[google]==1.7.1 # https://github.com/jschneier/django-storages
{%- elif cookiecutter.cloud_provider == 'Azure' %}
django-storages[azure]==1.7.1 # https://github.com/jschneier/django-storages
{%- endif %} {%- endif %}
django-anymail[mailgun]==6.1.0 # https://github.com/anymail/django-anymail django-anymail[mailgun]==6.1.0 # https://github.com/anymail/django-anymail

View File

@ -0,0 +1,25 @@
# Documentation
# ------------------------------------------------------------------------------
Sphinx==2.1.2 # https://github.com/sphinx-doc/sphinx
# Testing
# ------------------------------------------------------------------------------
mypy==0.720 # https://github.com/python/mypy
pytest==5.0.1 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
# Code quality
# ------------------------------------------------------------------------------
flake8==3.7.8 # https://github.com/PyCQA/flake8
coverage==4.5.3 # https://github.com/nedbat/coveragepy
black==19.3b0 # https://github.com/ambv/black
pylint-django==2.0.11 # https://github.com/PyCQA/pylint-django
{%- if cookiecutter.use_celery == 'y' %}
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
{%- endif %}
# Django plugins for testing
# ------------------------------------------------------------------------------
factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy
django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django==3.5.1 # https://github.com/pytest-dev/pytest-django

View File

@ -2,7 +2,7 @@ import os
from celery import Celery from celery import Celery
# set the default Django settings module for the 'celery' program. # set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{cookiecutter.project_slug}}.settings")
app = Celery("{{cookiecutter.project_slug}}") app = Celery("{{cookiecutter.project_slug}}")