fixed issues with autopep8 adding/spaces to jinja template engine

This commit is contained in:
genomics-geek 2019-06-03 08:36:08 -04:00
parent 99723ca506
commit 3b8b640d3c

View File

@ -3,12 +3,12 @@ Base settings to build other settings files upon.
""" """
import environ import environ
import os
# ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/) ROOT_DIR = (
ROOT_DIR = environ.Path(__file__) - 3 environ.Path(__file__) - 3
APPS_DIR = ROOT_DIR.path('{{ cookiecutter.project_slug }}') ) # ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/)
{% if cookiecutter.js_task_runner == "CreateReactApp" - %} APPS_DIR = ROOT_DIR.path("{{ cookiecutter.project_slug }}")
{% if cookiecutter.js_task_runner == "CreateReactApp" -%}
REACT_APP_DIR = ROOT_DIR.path('frontend') REACT_APP_DIR = ROOT_DIR.path('frontend')
{%- endif %} {%- endif %}
@ -44,7 +44,7 @@ LOCALE_PATHS = [ROOT_DIR.path("locale")]
# DATABASES # DATABASES
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#databases # https://docs.djangoproject.com/en/dev/ref/settings/#databases
{% if cookiecutter.use_docker == "y" - %} {% if cookiecutter.use_docker == "y" -%}
DATABASES = {"default": env.db("DATABASE_URL")} DATABASES = {"default": env.db("DATABASE_URL")}
{%- else %} {%- else %}
DATABASES = { DATABASES = {
@ -73,13 +73,13 @@ DJANGO_APPS = [
"django.contrib.admin", "django.contrib.admin",
] ]
THIRD_PARTY_APPS = [ THIRD_PARTY_APPS = [
'crispy_forms', "crispy_forms",
'allauth', "allauth",
'allauth.account', "allauth.account",
'allauth.socialaccount', "allauth.socialaccount",
'rest_framework', "rest_framework",
{% if cookiecutter.js_task_runner == "CreateReactApp" - %} {% if cookiecutter.js_task_runner == "CreateReactApp" -%}
'corsheaders', "corsheaders",
{%- endif %} {%- endif %}
] ]
LOCAL_APPS = [ LOCAL_APPS = [
@ -134,7 +134,7 @@ AUTH_PASSWORD_VALIDATORS = [
MIDDLEWARE = [ MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware", "django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.sessions.middleware.SessionMiddleware",
{% if cookiecutter.js_task_runner == "CreateReactApp" - %} {% if cookiecutter.js_task_runner == "CreateReactApp" -%}
"corsheaders.middleware.CorsMiddleware", # SEE: https://github.com/ottoyiu/django-cors-headers#setup "corsheaders.middleware.CorsMiddleware", # SEE: https://github.com/ottoyiu/django-cors-headers#setup
{%- endif %} {%- endif %}
"django.middleware.locale.LocaleMiddleware", "django.middleware.locale.LocaleMiddleware",
@ -153,9 +153,9 @@ STATIC_ROOT = str(ROOT_DIR("staticfiles"))
STATIC_URL = "/static/" STATIC_URL = "/static/"
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = [ STATICFILES_DIRS = [
str(APPS_DIR.path('static')), str(APPS_DIR.path("static"))
{% if cookiecutter.js_task_runner == "CreateReactApp" - %} {% if cookiecutter.js_task_runner == "CreateReactApp" -%}
os.path.join(str(REACT_APP_DIR.path('build')), 'static'), os.path.join(str(REACT_APP_DIR.path("build")), 'static'),
{%- endif %} {%- endif %}
] ]
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
@ -179,11 +179,11 @@ TEMPLATES = [
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND # https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
"BACKEND": "django.template.backends.django.DjangoTemplates", "BACKEND": "django.template.backends.django.DjangoTemplates",
# https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs # https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
'DIRS': [ "DIRS": [
str(APPS_DIR.path('templates')), str(APPS_DIR.path("templates")),
str(REACT_APP_DIR.path('build')), str(REACT_APP_DIR.path("build")),
], ],
'OPTIONS': { "OPTIONS": {
# https://docs.djangoproject.com/en/dev/ref/settings/#template-debug # https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
"debug": DEBUG, "debug": DEBUG,
# https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders # https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
@ -265,7 +265,7 @@ LOGGING = {
"root": {"level": "INFO", "handlers": ["console"]}, "root": {"level": "INFO", "handlers": ["console"]},
} }
{% if cookiecutter.use_celery == 'y' - %} {% if cookiecutter.use_celery == 'y' -%}
# Celery # Celery
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if USE_TZ: if USE_TZ:
@ -303,7 +303,7 @@ ACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.AccountAdapter"
# https://django-allauth.readthedocs.io/en/latest/configuration.html # https://django-allauth.readthedocs.io/en/latest/configuration.html
SOCIALACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.SocialAccountAdapter" SOCIALACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.SocialAccountAdapter"
{% if cookiecutter.use_compressor == 'y' - %} {% if cookiecutter.use_compressor == 'y' -%}
# django-compressor # django-compressor
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://django-compressor.readthedocs.io/en/latest/quickstart/#installation # https://django-compressor.readthedocs.io/en/latest/quickstart/#installation
@ -311,7 +311,7 @@ INSTALLED_APPS += ["compressor"]
STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"] STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]
{%- endif %} {%- endif %}
{% if cookiecutter.js_task_runner == "CreateReactApp" - %} {% if cookiecutter.js_task_runner == "CreateReactApp" -%}
# django-cors-headers # django-cors-headers
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://github.com/ottoyiu/django-cors-headers#cors_origin_allow_all # https://github.com/ottoyiu/django-cors-headers#cors_origin_allow_all