Merge branch 'master' into feature/docker-compose-gulp

# Conflicts:
#	{{cookiecutter.project_slug}}/package.json
This commit is contained in:
Bruno Alla 2018-09-17 23:14:55 +01:00
commit 0a72354775
13 changed files with 62 additions and 46 deletions

View File

@ -17,7 +17,5 @@ about: Report a bug
[//]: # (Any or all of the following:) [//]: # (Any or all of the following:)
[//]: # (* Host system configuration: OS, Docker & friends' versions etc.) [//]: # (* Host system configuration: OS, Docker & friends' versions etc.)
[//]: # (* Project generation options) [//]: # (* Replay file https://cookiecutter.readthedocs.io/en/latest/advanced/replay.html)
[//]: # (* Logs) [//]: # (* Logs)

View File

@ -103,6 +103,7 @@ Listed in alphabetical order.
Hendrik Schneider `@hendrikschneider`_ Hendrik Schneider `@hendrikschneider`_
Henrique G. G. Pereira `@ikkebr`_ Henrique G. G. Pereira `@ikkebr`_
Ian Lee `@IanLee1521`_ Ian Lee `@IanLee1521`_
Irfan Ahmad `@erfaan`_ @erfaan
Jan Van Bruggen `@jvanbrug`_ Jan Van Bruggen `@jvanbrug`_
Jens Nilsson `@phiberjenz`_ Jens Nilsson `@phiberjenz`_
Jimmy Gitonga `@afrowave`_ @afrowave Jimmy Gitonga `@afrowave`_ @afrowave
@ -161,6 +162,7 @@ Listed in alphabetical order.
Tom Atkins `@knitatoms`_ Tom Atkins `@knitatoms`_
Tom Offermann Tom Offermann
Travis McNeill `@Travistock`_ @tavistock_esq Travis McNeill `@Travistock`_ @tavistock_esq
Umair Ashraf `@umrashrf`_ @fabumair
Vitaly Babiy Vitaly Babiy
Vivian Guillen `@viviangb`_ Vivian Guillen `@viviangb`_
Will Farley `@goldhand`_ @g01dhand Will Farley `@goldhand`_ @g01dhand
@ -205,6 +207,7 @@ Listed in alphabetical order.
.. _@durkode: https://github.com/durkode .. _@durkode: https://github.com/durkode
.. _@epileptic-fish: https://gihub.com/epileptic-fish .. _@epileptic-fish: https://gihub.com/epileptic-fish
.. _@eraldo: https://github.com/eraldo .. _@eraldo: https://github.com/eraldo
.. _@erfaan: https://github.com/erfaan
.. _@eriol: https://github.com/eriol .. _@eriol: https://github.com/eriol
.. _@eyadsibai: https://github.com/eyadsibai .. _@eyadsibai: https://github.com/eyadsibai
.. _@flyudvik: https://github.com/flyudvik .. _@flyudvik: https://github.com/flyudvik
@ -274,6 +277,7 @@ Listed in alphabetical order.
.. _@pchiquet: https://github.com/pchiquet .. _@pchiquet: https://github.com/pchiquet
.. _@delneg: https://github.com/delneg .. _@delneg: https://github.com/delneg
.. _@purplediane: https://github.com/purplediane .. _@purplediane: https://github.com/purplediane
.. _@umrashrf: https://github.com/umrashrf
Special Thanks Special Thanks
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

View File

@ -28,8 +28,6 @@ production-ready Django projects quickly.
* If you have problems with Cookiecutter Django, please open issues_ don't send * If you have problems with Cookiecutter Django, please open issues_ don't send
emails to the maintainers. emails to the maintainers.
.. _cookiecutter: https://github.com/audreyr/cookiecutter
.. _Troubleshooting: https://cookiecutter-django.readthedocs.io/en/latest/troubleshooting.html .. _Troubleshooting: https://cookiecutter-django.readthedocs.io/en/latest/troubleshooting.html
.. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373 .. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373
@ -47,7 +45,7 @@ Features
* Optimized development and production settings * Optimized development and production settings
* Registration via django-allauth_ * Registration via django-allauth_
* Comes with custom user model ready to go * Comes with custom user model ready to go
* Grunt build for compass and livereload * Optional custom static build using Gulp and livereload
* Send emails via Anymail_ (using Mailgun_ by default, but switchable) * Send emails via Anymail_ (using Mailgun_ by default, but switchable)
* Media storage using Amazon S3 * Media storage using Amazon S3
* Docker support using docker-compose_ for development and production (using Caddy_ with LetsEncrypt_ support) * Docker support using docker-compose_ for development and production (using Caddy_ with LetsEncrypt_ support)
@ -180,10 +178,9 @@ Answer the prompts with your own desired options_. For example::
7 - 9.3 7 - 9.3
Choose from 1, 2, 3, 4 [1]: 1 Choose from 1, 2, 3, 4 [1]: 1
Select js_task_runner: Select js_task_runner:
1 - Gulp 1 - None
2 - Grunt 2 - Gulp
3 - None Choose from 1, 2 [1]: 1
Choose from 1, 2, 3, 4 [1]: 1
custom_bootstrap_compilation [n]: n custom_bootstrap_compilation [n]: n
Select open_source_license: Select open_source_license:
1 - MIT 1 - MIT

View File

@ -69,7 +69,7 @@ For instance, one of the packages we depend upon, ``django-allauth`` sends verif
Now you have your own mail server running locally, ready to receive whatever you send it. Now you have your own mail server running locally, ready to receive whatever you send it.
.. _MailHog: https://github.com/mailhog/MailHog/ .. _`Download the latest MailHog release`: https://github.com/mailhog/MailHog/releases
.. _`properly configured`: https://docs.djangoproject.com/en/dev/topics/email/#smtp-backend .. _`properly configured`: https://docs.djangoproject.com/en/dev/topics/email/#smtp-backend
@ -88,9 +88,9 @@ In production, we have Mailgun_ configured to have your back!
Sass Compilation & Live Reloading Sass Compilation & Live Reloading
--------------------------------- ---------------------------------
If youd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with a little bit of preparation_. If youd like to take advantage of live reloading and Sass compilation you can do so with a little bit of preparation_.
.. _`Download the latest MailHog release`: https://github.com/mailhog/MailHog/releases
.. _preparation: https://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html .. _preparation: https://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html

View File

@ -1,24 +1,22 @@
Sass Compilation & Live Reloading Sass Compilation & Live Reloading
================================= =================================
If you'd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with a little bit of prep work. If you'd like to take advantage of `live reload`_ and Sass compilation:
Make sure that nodejs_ is installed. Then in the project root run:: - Make sure that nodejs_ is installed. Then in the project root run::
$ npm install $ npm install
.. _nodejs: http://nodejs.org/download/ .. _nodejs: http://nodejs.org/download/
If you don't already have it, install `compass` (doesn't hurt if you run this command twice):: - Now you just need::
gem install compass
Now you just need::
$ npm run dev $ npm run dev
The base app will now run as it would with the usual ``manage.py runserver`` but with live reloading and Sass compilation enabled. The base app will now run as it would with the usual ``manage.py runserver`` but with live reloading and Sass compilation enabled.
When changing your Sass files, they will be automatically recompiled and change will be reflected in your browser without refreshing.
To get live reloading to work you'll probably need to install an `appropriate browser extension`_ To get live reloading to work you'll probably need to install an `appropriate browser extension`_
.. _live reload: http://livereload.com/
.. _appropriate browser extension: http://livereload.com/extensions/ .. _appropriate browser extension: http://livereload.com/extensions/

View File

@ -9,5 +9,5 @@ flake8==3.5.0
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
tox==3.2.1 tox==3.2.1
pytest==3.7.3 pytest==3.8.0
pytest-cookies==0.3.0 pytest-cookies==0.3.0

View File

@ -95,16 +95,25 @@ With MailHog running, to view messages that are sent by your application, open y
{% else %} {% else %}
In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use `MailHog`_ when generating the project a local SMTP server with a web interface will be available. In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use `MailHog`_ when generating the project a local SMTP server with a web interface will be available.
To start the service, make sure you have nodejs installed, and then type the following:: #. `Download the latest MailHog release`_ for your OS.
$ npm install #. Rename the build to ``MailHog``.
$ grunt serve
(After the first run you only need to type ``grunt serve``) This will start an email server that listens on ``127.0.0.1:1025`` in addition to starting your Django project and a watch task for live reload. #. Copy the file to the project root.
To view messages that are sent by your application, open your browser and go to ``http://127.0.0.1:8025`` #. Make it executable: ::
The email server will exit when you exit the Grunt task on the CLI with Ctrl+C. $ chmod +x MailHog
#. Spin up another terminal window and start it there: ::
./MailHog
#. Check out `<http://127.0.0.1:8025/>`_ to see how it goes.
Now you have your own mail server running locally, ready to receive whatever you send it.
.. _`Download the latest MailHog release`: https://github.com/mailhog/MailHog/releases
{% endif %} {% endif %}
.. _mailhog: https://github.com/mailhog/MailHog .. _mailhog: https://github.com/mailhog/MailHog
{% endif %} {% endif %}

View File

@ -1,5 +1,5 @@
www.{% raw %}{$DOMAIN_NAME}{% endraw %} { www.{% raw %}{$DOMAIN_NAME}{% endraw %} {
redir https://{{cookiecutter.domain_name}} redir https://{% raw %}{$DOMAIN_NAME}{% endraw %}
} }
{% raw %}{$DOMAIN_NAME}{% endraw %} { {% raw %}{$DOMAIN_NAME}{% endraw %} {

View File

@ -86,23 +86,33 @@ AWS_S3_OBJECT_PARAMETERS = {
{% if cookiecutter.use_whitenoise == 'y' -%} {% if cookiecutter.use_whitenoise == 'y' -%}
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
{%- else %} {%- else %}
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage' STATICFILES_STORAGE = 'config.settings.production.StaticRootS3Boto3Storage'
STATIC_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/static/' STATIC_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/static/'
{%- endif %} {%- endif %}
# MEDIA # MEDIA
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
{% if cookiecutter.use_whitenoise == 'y' -%} {% if cookiecutter.use_whitenoise == 'y' -%}
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/' MEDIA_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/'
{%- else %} {%- else %}
# region http://stackoverflow.com/questions/10390244/ # region http://stackoverflow.com/questions/10390244/
# Full-fledge class: https://stackoverflow.com/a/18046120/104731
from storages.backends.s3boto3 import S3Boto3Storage # noqa E402 from storages.backends.s3boto3 import S3Boto3Storage # noqa E402
StaticRootS3BotoStorage = lambda: S3Boto3Storage(location='static') # noqa
MediaRootS3BotoStorage = lambda: S3Boto3Storage(location='media', file_overwrite=False) # noqa
class StaticRootS3Boto3Storage(S3Boto3Storage):
location = 'static'
class MediaRootS3Boto3Storage(S3Boto3Storage):
location = 'media'
file_overwrite = False
# endregion # endregion
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3BotoStorage' DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3Boto3Storage'
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/media/' MEDIA_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/media/'
{%- endif %} {%- endif %}
# TEMPLATES # TEMPLATES
@ -154,7 +164,7 @@ INSTALLED_APPS += ['gunicorn'] # noqa F405
# WhiteNoise # WhiteNoise
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# http://whitenoise.evans.io/en/latest/django.html#enable-whitenoise # http://whitenoise.evans.io/en/latest/django.html#enable-whitenoise
MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware'] + MIDDLEWARE # noqa F405 MIDDLEWARE.insert(1, 'whitenoise.middleware.WhiteNoiseMiddleware') # noqa F405
{% endif %} {% endif %}
{%- if cookiecutter.use_compressor == 'y' -%} {%- if cookiecutter.use_compressor == 'y' -%}

View File

@ -23,7 +23,7 @@
"gulp-uglify": "^3.0.0", "gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
{% if cookiecutter.custom_bootstrap_compilation == 'y' -%} {% if cookiecutter.custom_bootstrap_compilation == 'y' -%}
"jquery": "3.3.1-slim", "jquery": "3.3.1",
"popper.js": "1.14.3", "popper.js": "1.14.3",
{% endif -%} {% endif -%}
"run-sequence": "^2.1.1" "run-sequence": "^2.1.1"

View File

@ -1,12 +1,12 @@
pytz==2018.5 # https://github.com/stub42/pytz pytz==2018.5 # https://github.com/stub42/pytz
python-slugify==1.2.5 # https://github.com/un33k/python-slugify python-slugify==1.2.6 # https://github.com/un33k/python-slugify
Pillow==5.2.0 # https://github.com/python-pillow/Pillow Pillow==5.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' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin
{%- endif %} {%- endif %}
argon2-cffi==18.3.0 # https://github.com/hynek/argon2_cffi argon2-cffi==18.3.0 # https://github.com/hynek/argon2_cffi
{%- if cookiecutter.use_whitenoise == 'y' %} {%- if cookiecutter.use_whitenoise == 'y' %}
whitenoise==4.0 # https://github.com/evansd/whitenoise whitenoise==4.1 # https://github.com/evansd/whitenoise
{%- endif %} {%- endif %}
redis>=2.10.5 # https://github.com/antirez/redis redis>=2.10.5 # https://github.com/antirez/redis
{%- if cookiecutter.use_celery == "y" %} {%- if cookiecutter.use_celery == "y" %}

View File

@ -2,7 +2,7 @@
Werkzeug==0.14.1 # https://github.com/pallets/werkzeug Werkzeug==0.14.1 # https://github.com/pallets/werkzeug
ipdb==0.11 # https://github.com/gotcha/ipdb ipdb==0.11 # https://github.com/gotcha/ipdb
Sphinx==1.7.8 # https://github.com/sphinx-doc/sphinx Sphinx==1.8.0 # https://github.com/sphinx-doc/sphinx
{%- if cookiecutter.use_docker == 'y' %} {%- if cookiecutter.use_docker == 'y' %}
psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2
{%- else %} {%- else %}
@ -12,7 +12,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
mypy==0.620 # https://github.com/python/mypy mypy==0.620 # https://github.com/python/mypy
pytest==3.7.3 # https://github.com/pytest-dev/pytest pytest==3.8.0 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar
# Code quality # Code quality
@ -24,7 +24,7 @@ coverage==4.5.1 # https://github.com/nedbat/coveragepy
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy
django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-debug-toolbar==1.10.1 # https://github.com/jazzband/django-debug-toolbar
django-extensions==2.1.2 # https://github.com/django-extensions/django-extensions django-extensions==2.1.2 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django==3.4.2 # https://github.com/pytest-dev/pytest-django pytest-django==3.4.3 # https://github.com/pytest-dev/pytest-django

View File

@ -13,5 +13,5 @@ raven==6.9.0 # https://github.com/getsentry/raven-python
# Django # Django
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
django-storages[boto3]==1.6.6 # https://github.com/jschneier/django-storages django-storages[boto3]==1.7.1 # https://github.com/jschneier/django-storages
django-anymail[mailgun]==4.1 # https://github.com/anymail/django-anymail django-anymail[mailgun]==4.2 # https://github.com/anymail/django-anymail