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