mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-27 03:54:02 +03:00
Merge commit '769b7bb882e59eaa56b11f85b680b6d13d41377c'
This commit is contained in:
commit
31ba7828da
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: danielroygreenfeld
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: ['https://www.patreon.com/browniebroke']
|
|
@ -59,3 +59,12 @@ if "{{ cookiecutter.use_docker }}".lower() == "n":
|
||||||
)
|
)
|
||||||
+ TERMINATOR
|
+ TERMINATOR
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (
|
||||||
|
"{{ cookiecutter.use_whitenoise }}".lower() == "n"
|
||||||
|
and "{{ cookiecutter.cloud_provider }}" == "None"
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"You should either use Whitenoise or select a Cloud Provider to serve static files"
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
|
@ -9,9 +9,9 @@ flake8==3.7.8
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
tox==3.13.2
|
tox==3.14.0
|
||||||
pytest==5.1.1
|
pytest==5.2.0
|
||||||
pytest_cases==1.11.1
|
pytest_cases==1.11.3
|
||||||
pytest-cookies==0.4.0
|
pytest-cookies==0.4.0
|
||||||
pytest-xdist==1.29.0
|
pytest-xdist==1.30.0
|
||||||
pyyaml==5.1.2
|
pyyaml==5.1.2
|
||||||
|
|
|
@ -49,6 +49,11 @@ def context_combination(
|
||||||
cloud_provider,
|
cloud_provider,
|
||||||
):
|
):
|
||||||
"""Fixture that parametrize the function where it's used."""
|
"""Fixture that parametrize the function where it's used."""
|
||||||
|
if cloud_provider == "None":
|
||||||
|
# Either of the two should be set for serving static files, so if cloud provider
|
||||||
|
# is not set, we force Whitenoise to be set
|
||||||
|
use_whitenoise = "y"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"windows": windows,
|
"windows": windows,
|
||||||
"use_docker": use_docker,
|
"use_docker": use_docker,
|
||||||
|
@ -157,3 +162,12 @@ def test_invalid_slug(cookies, context, slug):
|
||||||
|
|
||||||
assert result.exit_code != 0
|
assert result.exit_code != 0
|
||||||
assert isinstance(result.exception, FailedHookException)
|
assert isinstance(result.exception, FailedHookException)
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_whitenoise_and_no_cloud_provider(cookies, context):
|
||||||
|
"""It should not generate project if neither whitenoise or cloud provider are set"""
|
||||||
|
context.update({"use_whitenoise": "n", "cloud_provider": "None"})
|
||||||
|
result = cookies.bake(extra_context=context)
|
||||||
|
|
||||||
|
assert result.exit_code != 0
|
||||||
|
assert isinstance(result.exception, FailedHookException)
|
||||||
|
|
|
@ -187,6 +187,7 @@ TEMPLATES = [
|
||||||
"django.template.context_processors.static",
|
"django.template.context_processors.static",
|
||||||
"django.template.context_processors.tz",
|
"django.template.context_processors.tz",
|
||||||
"django.contrib.messages.context_processors.messages",
|
"django.contrib.messages.context_processors.messages",
|
||||||
|
"{{ cookiecutter.project_slug }}.utils.context_processors.settings_context",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,19 +28,19 @@ CACHES = {
|
||||||
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' -%}
|
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' -%}
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
||||||
EMAIL_HOST = env("EMAIL_HOST", default="mailhog")
|
EMAIL_HOST = env("EMAIL_HOST", default="mailhog")
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
|
||||||
|
EMAIL_PORT = 1025
|
||||||
{%- elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' -%}
|
{%- elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' -%}
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
||||||
EMAIL_HOST = "localhost"
|
EMAIL_HOST = "localhost"
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
|
||||||
|
EMAIL_PORT = 1025
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
||||||
EMAIL_BACKEND = env(
|
EMAIL_BACKEND = env(
|
||||||
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
|
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
|
||||||
)
|
)
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
|
||||||
EMAIL_HOST = "localhost"
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
|
|
||||||
EMAIL_PORT = 1025
|
|
||||||
|
|
||||||
# django-debug-toolbar
|
# django-debug-toolbar
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -201,7 +201,6 @@ COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' or cookiecutte
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# https://github.com/antonagestam/collectfast#installation
|
# https://github.com/antonagestam/collectfast#installation
|
||||||
INSTALLED_APPS = ["collectfast"] + INSTALLED_APPS # noqa F405
|
INSTALLED_APPS = ["collectfast"] + INSTALLED_APPS # noqa F405
|
||||||
AWS_PRELOAD_METADATA = True
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
# LOGGING
|
# LOGGING
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -7,8 +7,6 @@ from .base import env
|
||||||
|
|
||||||
# GENERAL
|
# GENERAL
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
|
||||||
DEBUG = False
|
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
||||||
SECRET_KEY = env(
|
SECRET_KEY = env(
|
||||||
"DJANGO_SECRET_KEY",
|
"DJANGO_SECRET_KEY",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
[pytest]
|
[pytest]
|
||||||
addopts = --ds=config.settings.test
|
addopts = --ds=config.settings.test
|
||||||
|
python_files = tests.py test_*.py
|
||||||
{%- if cookiecutter.js_task_runner != 'None' %}
|
{%- if cookiecutter.js_task_runner != 'None' %}
|
||||||
norecursedirs = node_modules
|
norecursedirs = node_modules
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
pytz==2019.2 # https://github.com/stub42/pytz
|
pytz==2019.2 # https://github.com/stub42/pytz
|
||||||
python-slugify==3.0.3 # https://github.com/un33k/python-slugify
|
python-slugify==3.0.4 # https://github.com/un33k/python-slugify
|
||||||
Pillow==6.1.0 # https://github.com/python-pillow/Pillow
|
Pillow==6.2.0 # https://github.com/python-pillow/Pillow
|
||||||
{%- if cookiecutter.use_compressor == "y" %}
|
{%- if cookiecutter.use_compressor == "y" %}
|
||||||
rcssmin==1.0.6{% if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin
|
rcssmin==1.0.6{% if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
argon2-cffi==19.1.0 # https://github.com/hynek/argon2_cffi
|
argon2-cffi==19.1.0 # https://github.com/hynek/argon2_cffi
|
||||||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||||
whitenoise==4.1.3 # https://github.com/evansd/whitenoise
|
whitenoise==4.1.4 # https://github.com/evansd/whitenoise
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
redis==3.3.8 # https://github.com/antirez/redis
|
redis==3.3.8 # https://github.com/antirez/redis
|
||||||
{%- if cookiecutter.use_celery == "y" %}
|
{%- if cookiecutter.use_celery == "y" %}
|
||||||
|
@ -19,10 +19,10 @@ flower==0.9.3 # https://github.com/mher/flower
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
django==2.2.4 # pyup: < 3.0 # https://www.djangoproject.com/
|
django==2.2.6 # 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.40.0 # https://github.com/pennersr/django-allauth
|
||||||
django-crispy-forms==1.7.2 # https://github.com/django-crispy-forms/django-crispy-forms
|
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
|
||||||
|
@ -30,5 +30,5 @@ django-compressor==2.3 # https://github.com/django-compressor/django-compressor
|
||||||
django-redis==4.10.0 # https://github.com/niwinz/django-redis
|
django-redis==4.10.0 # https://github.com/niwinz/django-redis
|
||||||
|
|
||||||
# Django REST Framework
|
# Django REST Framework
|
||||||
djangorestframework==3.10.2 # https://github.com/encode/django-rest-framework
|
djangorestframework==3.10.3 # https://github.com/encode/django-rest-framework
|
||||||
coreapi==2.3.3 # https://github.com/core-api/python-client
|
coreapi==2.3.3 # https://github.com/core-api/python-client
|
||||||
|
|
|
@ -11,8 +11,8 @@ psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
mypy==0.720 # https://github.com/python/mypy
|
mypy==0.730 # https://github.com/python/mypy
|
||||||
pytest==5.1.1 # https://github.com/pytest-dev/pytest
|
pytest==5.2.0 # https://github.com/pytest-dev/pytest
|
||||||
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
|
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
|
||||||
|
|
||||||
# Code quality
|
# Code quality
|
||||||
|
@ -30,6 +30,6 @@ pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
|
||||||
factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy
|
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.2.1 # https://github.com/django-extensions/django-extensions
|
django-extensions==2.2.3 # https://github.com/django-extensions/django-extensions
|
||||||
django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin
|
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
|
pytest-django==3.5.1 # https://github.com/pytest-dev/pytest-django
|
||||||
|
|
|
@ -8,14 +8,14 @@ psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2
|
||||||
Collectfast==1.0.0 # https://github.com/antonagestam/collectfast
|
Collectfast==1.0.0 # https://github.com/antonagestam/collectfast
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.use_sentry == "y" %}
|
{%- if cookiecutter.use_sentry == "y" %}
|
||||||
sentry-sdk==0.11.1 # https://github.com/getsentry/sentry-python
|
sentry-sdk==0.12.3 # https://github.com/getsentry/sentry-python
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
||||||
django-storages[boto3]==1.7.1 # https://github.com/jschneier/django-storages
|
django-storages[boto3]==1.7.2 # 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.2 # https://github.com/jschneier/django-storages
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
django-anymail[mailgun]==6.1.0 # https://github.com/anymail/django-anymail
|
django-anymail[mailgun]==7.0.0 # https://github.com/anymail/django-anymail
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
def settings_context(_request):
|
||||||
|
return {"settings": settings}
|
Loading…
Reference in New Issue
Block a user