diff --git a/docs/developing-locally.rst b/docs/developing-locally.rst index a5d598f0b..0da265484 100644 --- a/docs/developing-locally.rst +++ b/docs/developing-locally.rst @@ -24,9 +24,9 @@ First things first. $ source /bin/activate -#. Install cookiecutter-django +#. Install cookiecutter-django: :: - $ cookiecutter gh:pydanny/cookiecutter-django :: + $ cookiecutter gh:pydanny/cookiecutter-django #. Install development requirements: :: diff --git a/docs/document.rst b/docs/document.rst index 990bbe8a7..15a5396e1 100644 --- a/docs/document.rst +++ b/docs/document.rst @@ -18,7 +18,7 @@ Navigate to port 7000 on your host to see the documentation. This will be opened Generate API documentation ---------------------------- -Edit the docs/_source files and project application docstrings to create your documentation. +Edit the ``docs/_source`` files and project application docstrings to create your documentation. Sphinx can automatically include class and function signatures and docstrings in generated documentation. See the generated project documentation for more examples. diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 1c2fc3149..ec52e2183 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -49,11 +49,11 @@ use_docker: postgresql_version: Select a PostgreSQL_ version to use. The choices are: - 1. 11.3 - 2. 10.8 - 3. 9.6 - 4. 9.5 - 5. 9.4 + 1. 12.3 + 2. 11.8 + 3. 10.8 + 4. 9.6 + 5. 9.5 js_task_runner: Select a JavaScript task runner. The choices are: diff --git a/requirements.txt b/requirements.txt index 400fa9b15..ac6c7f18d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ flake8-isort==3.0.1 # Testing # ------------------------------------------------------------------------------ -tox==3.17.1 +tox==3.18.0 pytest==5.4.3 pytest-cookies==0.5.1 pytest-instafail==0.4.2 diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 3853142c6..ba5ac99f7 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -80,6 +80,7 @@ THIRD_PARTY_APPS = [ {%- if cookiecutter.use_drf == "y" %} "rest_framework", "rest_framework.authtoken", + "corsheaders", {%- endif %} {%- if cookiecutter.use_vue == "y" %} "webpack_loader", @@ -143,6 +144,9 @@ AUTH_PASSWORD_VALIDATORS = [ # https://docs.djangoproject.com/en/dev/ref/settings/#middleware MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", +{%- if cookiecutter.use_drf == 'y' %} + "corsheaders.middleware.CorsMiddleware", +{%- endif %} {%- if cookiecutter.use_whitenoise == 'y' %} "whitenoise.middleware.WhiteNoiseMiddleware", {%- endif %} @@ -330,6 +334,10 @@ REST_FRAMEWORK = { ), "DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",), } + +# django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup +CORS_URLS_REGEX = r"^/api/.*$" + {%- endif %} {% if cookiecutter.use_vue == "y" -%} diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 9daeea66f..7eb5c4b98 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -14,7 +14,7 @@ whitenoise==5.1.0 # https://github.com/evansd/whitenoise {%- endif %} redis==3.5.3 # https://github.com/andymccurdy/redis-py {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} -hiredis==1.0.1 # https://github.com/redis/hiredis-py +hiredis==1.1.0 # https://github.com/redis/hiredis-py {%- endif %} {%- if cookiecutter.use_celery == "y" %} celery==4.4.6 # pyup: < 5.0 # https://github.com/celery/celery @@ -24,7 +24,7 @@ flower==0.9.5 # https://github.com/mher/flower {%- endif %} {%- endif %} {%- if cookiecutter.use_async == 'y' %} -uvicorn==0.11.5 # https://github.com/encode/uvicorn +uvicorn==0.11.6 # https://github.com/encode/uvicorn {%- endif %} # Django @@ -33,7 +33,7 @@ django==3.0.8 # pyup: < 3.1 # https://www.djangoproject.com/ django-environ==0.4.5 # https://github.com/joke2k/django-environ django-model-utils==4.0.0 # https://github.com/jazzband/django-model-utils django-allauth==0.42.0 # https://github.com/pennersr/django-allauth -django-crispy-forms==1.9.1 # https://github.com/django-crispy-forms/django-crispy-forms +django-crispy-forms==1.9.2 # https://github.com/django-crispy-forms/django-crispy-forms {%- if cookiecutter.use_compressor == "y" %} django-compressor==2.4 # https://github.com/django-compressor/django-compressor {%- endif %} @@ -41,6 +41,7 @@ django-redis==4.12.1 # https://github.com/jazzband/django-redis {%- if cookiecutter.use_drf == "y" %} # Django REST Framework djangorestframework==3.11.0 # https://github.com/encode/django-rest-framework +django-cors-headers==3.4.0 # https://github.com/adamchainz/django-cors-headers {%- endif %} {%- if cookiecutter.use_vue == "y" %} django-webpack-loader==0.6.0 # https://github.com/owais/django-webpack-loader diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 0f9e2c8f1..793d76778 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -1,4 +1,4 @@ --r ./base.txt +-r base.txt Werkzeug==1.0.1 # https://github.com/pallets/werkzeug ipdb==0.13.3 # https://github.com/gotcha/ipdb @@ -16,7 +16,7 @@ watchgod==0.6 # https://github.com/samuelcolvin/watchgod mypy==0.782 # https://github.com/python/mypy django-stubs==1.5.0 # https://github.com/typeddjango/django-stubs pytest==5.4.3 # https://github.com/pytest-dev/pytest -pytest-sugar==0.9.3 # https://github.com/Frozenball/pytest-sugar +pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar # Documentation # ------------------------------------------------------------------------------ @@ -27,9 +27,9 @@ sphinx-autobuild==0.7.1 # https://github.com/GaretJax/sphinx-autobuild # ------------------------------------------------------------------------------ flake8==3.8.3 # https://github.com/PyCQA/flake8 flake8-isort==3.0.1 # https://github.com/gforcada/flake8-isort -coverage==5.2 # https://github.com/nedbat/coveragepy +coverage==5.2.1 # https://github.com/nedbat/coveragepy black==19.10b0 # https://github.com/ambv/black -pylint-django==2.1.0 # https://github.com/PyCQA/pylint-django +pylint-django==2.2.0 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery {%- endif %} diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index afd777b78..5ae320073 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -1,6 +1,6 @@ # PRECAUTION: avoid production dependencies that aren't in development --r ./base.txt +-r base.txt gunicorn==20.0.4 # https://github.com/benoitc/gunicorn psycopg2==2.8.5 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 @@ -8,10 +8,10 @@ psycopg2==2.8.5 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==2.2.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==0.16.1 # https://github.com/getsentry/sentry-python +sentry-sdk==0.16.2 # https://github.com/getsentry/sentry-python {%- endif %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} -hiredis==1.0.1 # https://github.com/redis/hiredis-py +hiredis==1.1.0 # https://github.com/redis/hiredis-py {%- endif %} # Django @@ -22,21 +22,21 @@ django-storages[boto3]==1.9.1 # https://github.com/jschneier/django-storages django-storages[google]==1.9.1 # https://github.com/jschneier/django-storages {%- endif %} {%- if cookiecutter.mail_service == 'Mailgun' %} -django-anymail[mailgun]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[mailgun]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Amazon SES' %} -django-anymail[amazon_ses]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[amazon_ses]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Mailjet' %} -django-anymail[mailjet]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[mailjet]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Mandrill' %} -django-anymail[mandrill]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[mandrill]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Postmark' %} -django-anymail[postmark]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[postmark]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Sendgrid' %} -django-anymail[sendgrid]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[sendgrid]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'SendinBlue' %} -django-anymail[sendinblue]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[sendinblue]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'SparkPost' %} -django-anymail[sparkpost]==7.1.0 # https://github.com/anymail/django-anymail +django-anymail[sparkpost]==7.2 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Other SMTP' %} -django-anymail==7.1.0 # https://github.com/anymail/django-anymail +django-anymail==7.2 # https://github.com/anymail/django-anymail {%- endif %} diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html index 39530042f..96b774cd9 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html @@ -5,8 +5,8 @@ {% block title %}{% endraw %}{{ cookiecutter.project_name }}{% raw %}{% endblock title %} - - + +