mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-28 04:24:02 +03:00
Merge commit '9db7f11675408a480363a7f837630d55e2ecc2f6'
This commit is contained in:
commit
989d9fc261
4
.github/ISSUE_TEMPLATE/bug.md
vendored
4
.github/ISSUE_TEMPLATE/bug.md
vendored
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ Listed in alphabetical order.
|
||||||
Bouke Haarsma
|
Bouke Haarsma
|
||||||
Brent Payne `@brentpayne`_ @brentpayne
|
Brent Payne `@brentpayne`_ @brentpayne
|
||||||
Burhan Khalid `@burhan`_ @burhan
|
Burhan Khalid `@burhan`_ @burhan
|
||||||
|
Carl Johnson `@carlmjohnson`_ @carlmjohnson
|
||||||
Catherine Devlin `@catherinedevlin`_
|
Catherine Devlin `@catherinedevlin`_
|
||||||
Cédric Gaspoz `@cgaspoz`_
|
Cédric Gaspoz `@cgaspoz`_
|
||||||
Charlie Smith `@chuckus`_
|
Charlie Smith `@chuckus`_
|
||||||
|
@ -78,6 +79,7 @@ Listed in alphabetical order.
|
||||||
Chris Franklin `@hairychris`_
|
Chris Franklin `@hairychris`_
|
||||||
Chris Pappalardo `@ChrisPappalardo`_
|
Chris Pappalardo `@ChrisPappalardo`_
|
||||||
Christopher Clarke `@chrisdev`_
|
Christopher Clarke `@chrisdev`_
|
||||||
|
Cole Mackenzie `@cmackenzie1`_
|
||||||
Collederas `@Collederas`_
|
Collederas `@Collederas`_
|
||||||
Cristian Vargas `@cdvv7788`_
|
Cristian Vargas `@cdvv7788`_
|
||||||
Cullen Rhodes `@c-rhodes`_
|
Cullen Rhodes `@c-rhodes`_
|
||||||
|
@ -85,6 +87,7 @@ Listed in alphabetical order.
|
||||||
Daniel Hepper `@dhepper`_ @danielhepper
|
Daniel Hepper `@dhepper`_ @danielhepper
|
||||||
Daniele Tricoli `@eriol`_
|
Daniele Tricoli `@eriol`_
|
||||||
David Díaz `@ddiazpinto`_ @DavidDiazPinto
|
David Díaz `@ddiazpinto`_ @DavidDiazPinto
|
||||||
|
Davit Tovmasyan `@davitovmasyan`_
|
||||||
Davur Clementsen `@dsclementsen`_ @davur
|
Davur Clementsen `@dsclementsen`_ @davur
|
||||||
Delio Castillo `@jangeador`_ @jangeador
|
Delio Castillo `@jangeador`_ @jangeador
|
||||||
Denis Orehovsky `@apirobot`_
|
Denis Orehovsky `@apirobot`_
|
||||||
|
@ -103,8 +106,10 @@ 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`_
|
||||||
|
Jerome Leclanche `@jleclanche`_ @Adys
|
||||||
Jimmy Gitonga `@afrowave`_ @afrowave
|
Jimmy Gitonga `@afrowave`_ @afrowave
|
||||||
John Cass `@jcass77`_ @cass_john
|
John Cass `@jcass77`_ @cass_john
|
||||||
Julien Almarcha `@sladinji`_
|
Julien Almarcha `@sladinji`_
|
||||||
|
@ -118,6 +123,7 @@ Listed in alphabetical order.
|
||||||
Krzysztof Szumny `@noisy`_
|
Krzysztof Szumny `@noisy`_
|
||||||
Krzysztof Żuraw `@krzysztofzuraw`_
|
Krzysztof Żuraw `@krzysztofzuraw`_
|
||||||
Leonardo Jimenez `@xpostudio4`_
|
Leonardo Jimenez `@xpostudio4`_
|
||||||
|
Leo Zhou `@glasslion`_
|
||||||
Lin Xianyi `@iynaix`_
|
Lin Xianyi `@iynaix`_
|
||||||
Luis Nell `@originell`_
|
Luis Nell `@originell`_
|
||||||
Lukas Klein
|
Lukas Klein
|
||||||
|
@ -139,6 +145,7 @@ Listed in alphabetical order.
|
||||||
Pablo `@oubiga`_
|
Pablo `@oubiga`_
|
||||||
Parbhat Puri `@parbhat`_
|
Parbhat Puri `@parbhat`_
|
||||||
Peter Bittner `@bittner`_
|
Peter Bittner `@bittner`_
|
||||||
|
Peter Coles `@mrcoles`_
|
||||||
Pierre Chiquet `@pchiquet`_
|
Pierre Chiquet `@pchiquet`_
|
||||||
Raphael Pierzina `@hackebrot`_
|
Raphael Pierzina `@hackebrot`_
|
||||||
Raony Guimarães Corrêa `@raonyguimaraes`_
|
Raony Guimarães Corrêa `@raonyguimaraes`_
|
||||||
|
@ -161,12 +168,15 @@ 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
|
||||||
William Archinal `@archinal`_
|
William Archinal `@archinal`_
|
||||||
Yaroslav Halchenko
|
Yaroslav Halchenko
|
||||||
Denis Bobrov `@delneg`_
|
Denis Bobrov `@delneg`_
|
||||||
|
Philipp Matthies `@canonnervio`_
|
||||||
|
Vadim Iskuchekov `@Egregors`_ @egregors
|
||||||
========================== ============================ ==============
|
========================== ============================ ==============
|
||||||
|
|
||||||
.. _@a7p: https://github.com/a7p
|
.. _@a7p: https://github.com/a7p
|
||||||
|
@ -189,6 +199,7 @@ Listed in alphabetical order.
|
||||||
.. _@burhan: https://github.com/burhan
|
.. _@burhan: https://github.com/burhan
|
||||||
.. _@c-rhodes: https://github.com/c-rhodes
|
.. _@c-rhodes: https://github.com/c-rhodes
|
||||||
.. _@caffodian: https://github.com/caffodian
|
.. _@caffodian: https://github.com/caffodian
|
||||||
|
.. _@carlmjohnson: https://github.com/carlmjohnson
|
||||||
.. _@catherinedevlin: https://github.com/catherinedevlin
|
.. _@catherinedevlin: https://github.com/catherinedevlin
|
||||||
.. _@ccurvey: https://github.com/ccurvey
|
.. _@ccurvey: https://github.com/ccurvey
|
||||||
.. _@cdvv7788: https://github.com/cdvv7788
|
.. _@cdvv7788: https://github.com/cdvv7788
|
||||||
|
@ -196,7 +207,9 @@ Listed in alphabetical order.
|
||||||
.. _@chrisdev: https://github.com/chrisdev
|
.. _@chrisdev: https://github.com/chrisdev
|
||||||
.. _@ChrisPappalardo: https://github.com/ChrisPappalardo
|
.. _@ChrisPappalardo: https://github.com/ChrisPappalardo
|
||||||
.. _@chuckus: https://github.com/chuckus
|
.. _@chuckus: https://github.com/chuckus
|
||||||
|
.. _@cmackenzie1: https://github.com/cmackenzie1
|
||||||
.. _@Collederas: https://github.com/Collederas
|
.. _@Collederas: https://github.com/Collederas
|
||||||
|
.. _@davitovmasyan: https://github.com/davitovmasyan
|
||||||
.. _@ddiazpinto: https://github.com/ddiazpinto
|
.. _@ddiazpinto: https://github.com/ddiazpinto
|
||||||
.. _@dezoito: https://github.com/dezoito
|
.. _@dezoito: https://github.com/dezoito
|
||||||
.. _@dhepper: https://github.com/dhepper
|
.. _@dhepper: https://github.com/dhepper
|
||||||
|
@ -205,20 +218,23 @@ 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
|
||||||
.. _@garry-cairns: https://github.com/garry-cairns
|
.. _@garry-cairns: https://github.com/garry-cairns
|
||||||
.. _@garrypolley: https://github.com/garrypolley
|
.. _@garrypolley: https://github.com/garrypolley
|
||||||
.. _@goldhand: https://github.com/goldhand
|
.. _@goldhand: https://github.com/goldhand
|
||||||
|
.. _@glasslion: https://github.com/glasslion
|
||||||
.. _@hackebrot: https://github.com/hackebrot
|
.. _@hackebrot: https://github.com/hackebrot
|
||||||
.. _@hairychris: https://github.com/hairychris
|
.. _@hairychris: https://github.com/hairychris
|
||||||
.. _@hendrikschneider https://github.com/hendrikschneider
|
.. _@hendrikschneider: https://github.com/hendrikschneider
|
||||||
.. _@hjwp: https://github.com/hjwp
|
.. _@hjwp: https://github.com/hjwp
|
||||||
.. _@IanLee1521: https://github.com/IanLee1521
|
.. _@IanLee1521: https://github.com/IanLee1521
|
||||||
.. _@ikkebr: https://github.com/ikkebr
|
.. _@ikkebr: https://github.com/ikkebr
|
||||||
.. _@iynaix: https://github.com/iynaix
|
.. _@iynaix: https://github.com/iynaix
|
||||||
.. _@jazztpt: https://github.com/jazztpt
|
.. _@jazztpt: https://github.com/jazztpt
|
||||||
|
.. _@jleclanche: https://github.com/jleclanche
|
||||||
.. _@juliocc: https://github.com/juliocc
|
.. _@juliocc: https://github.com/juliocc
|
||||||
.. _@jvanbrug: https://github.com/jvanbrug
|
.. _@jvanbrug: https://github.com/jvanbrug
|
||||||
.. _@ka7eh: https://github.com/ka7eh
|
.. _@ka7eh: https://github.com/ka7eh
|
||||||
|
@ -274,6 +290,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
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
11
README.rst
11
README.rst
|
@ -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
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"project_name": "My Awesome Project",
|
"project_name": "My Awesome Project",
|
||||||
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}",
|
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_')|replace('.', '_')|trim() }}",
|
||||||
"description": "Behold My Awesome Project!",
|
"description": "Behold My Awesome Project!",
|
||||||
"author_name": "Daniel Roy Greenfeld",
|
"author_name": "Daniel Roy Greenfeld",
|
||||||
"domain_name": "example.com",
|
"domain_name": "example.com",
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
"use_pycharm": "n",
|
"use_pycharm": "n",
|
||||||
"use_docker": "n",
|
"use_docker": "n",
|
||||||
"postgresql_version": [
|
"postgresql_version": [
|
||||||
|
"10.5",
|
||||||
"10.4",
|
"10.4",
|
||||||
"10.3",
|
"10.3",
|
||||||
"10.2",
|
"10.2",
|
||||||
|
|
0
docs/_static/.gitkeep
vendored
Normal file
0
docs/_static/.gitkeep
vendored
Normal file
|
@ -10,6 +10,8 @@ Run these commands to deploy the project to Heroku:
|
||||||
heroku create --buildpack https://github.com/heroku/heroku-buildpack-python
|
heroku create --buildpack https://github.com/heroku/heroku-buildpack-python
|
||||||
|
|
||||||
heroku addons:create heroku-postgresql:hobby-dev
|
heroku addons:create heroku-postgresql:hobby-dev
|
||||||
|
# On Windows use double quotes for the time zone, e.g.
|
||||||
|
# heroku pg:backups schedule --at "02:00 America/Los_Angeles" DATABASE_URL
|
||||||
heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL
|
heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL
|
||||||
heroku pg:promote DATABASE_URL
|
heroku pg:promote DATABASE_URL
|
||||||
|
|
||||||
|
|
|
@ -9,23 +9,54 @@ Setting Up Development Environment
|
||||||
|
|
||||||
Make sure to have the following on your host:
|
Make sure to have the following on your host:
|
||||||
|
|
||||||
* virtualenv_;
|
* Python 3.6
|
||||||
* pip;
|
* PostgreSQL_.
|
||||||
* PostgreSQL.
|
* Redis_, if using Celery
|
||||||
|
|
||||||
First things first.
|
First things first.
|
||||||
|
|
||||||
#. `Create a virtualenv`_.
|
#. Create a virtualenv: ::
|
||||||
|
|
||||||
#. Activate the virtualenv you have just created.
|
$ python3.6 -m venv <virtual env path>
|
||||||
|
|
||||||
|
#. Activate the virtualenv you have just created: ::
|
||||||
|
|
||||||
|
$ source <virtual env path>/bin/activate
|
||||||
|
|
||||||
#. Install development requirements: ::
|
#. Install development requirements: ::
|
||||||
|
|
||||||
$ pip install -r requirements/local.txt
|
$ pip install -r requirements/local.txt
|
||||||
|
|
||||||
#. Create a new PostgreSQL database (note: if this is the first time a database is created on your machine you might need to alter a localhost-related entry in your ``pg_hba.conf`` so as to utilize ``trust`` policy): ::
|
#. Create a new PostgreSQL database using createdb_: ::
|
||||||
|
|
||||||
$ createdb <what you've entered as the project_slug at setup stage>
|
$ createdb <what you have entered as the project_slug at setup stage> -U postgres --password <password>
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
if this is the first time a database is created on your machine you might need an
|
||||||
|
`initial PostgreSQL set up`_ to allow local connections & set a password for
|
||||||
|
the ``postgres`` user. The `postgres documentation`_ explains the syntax of the config file
|
||||||
|
that you need to change.
|
||||||
|
|
||||||
|
|
||||||
|
#. Set the environment variables for your database(s): ::
|
||||||
|
|
||||||
|
$ export DATABASE_URL=postgres://postgres:<password>@127.0.0.1:5432/<DB name given to createdb>
|
||||||
|
# Optional: set broker URL if using Celery
|
||||||
|
$ export CELERY_BROKER_URL=redis://localhost:6379/0
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Check out the :ref:`settings` page for a comprehensive list of the environments variables.
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
|
||||||
|
To help setting up your environment variables, you have a few options:
|
||||||
|
|
||||||
|
* create an ``.env`` file in the root of your project and define all the variables you need in it.
|
||||||
|
Then you just need to have ``DJANGO_READ_DOT_ENV_FILE=True`` in your machine and all the variables
|
||||||
|
will be read.
|
||||||
|
* Use a local environment manager like `direnv`_
|
||||||
|
|
||||||
#. Apply migrations: ::
|
#. Apply migrations: ::
|
||||||
|
|
||||||
|
@ -35,8 +66,12 @@ First things first.
|
||||||
|
|
||||||
$ python manage.py runserver 0.0.0.0:8000
|
$ python manage.py runserver 0.0.0.0:8000
|
||||||
|
|
||||||
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
|
.. _PostgreSQL: https://www.postgresql.org/download/
|
||||||
.. _`Create a virtualenv`: https://virtualenv.pypa.io/en/stable/userguide/
|
.. _Redis: https://redis.io/download
|
||||||
|
.. _createdb: https://www.postgresql.org/docs/current/static/app-createdb.html
|
||||||
|
.. _initial PostgreSQL set up: http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/firstconnect.html
|
||||||
|
.. _postgres documentation: https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
|
||||||
|
.. _direnv: https://direnv.net/
|
||||||
|
|
||||||
|
|
||||||
Setup Email Backend
|
Setup Email Backend
|
||||||
|
@ -69,9 +104,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
|
||||||
.. _`properly configured`: https://docs.djangoproject.com/en/dev/topics/email/#smtp-backend
|
|
||||||
|
|
||||||
|
|
||||||
Console
|
Console
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -88,11 +121,8 @@ In production, we have Mailgun_ configured to have your back!
|
||||||
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 preparation_.
|
If you’d like to take advantage of live reloading and Sass compilation you can do so with a little
|
||||||
|
bit of preparation, see :ref:`sass-compilation-live-reload`.
|
||||||
.. _`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
|
|
||||||
|
|
||||||
|
|
||||||
Summary
|
Summary
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -17,7 +17,7 @@ Contents:
|
||||||
developing-locally-docker
|
developing-locally-docker
|
||||||
settings
|
settings
|
||||||
linters
|
linters
|
||||||
live-reloading-and-sass-compilation
|
testing
|
||||||
deployment-on-pythonanywhere
|
deployment-on-pythonanywhere
|
||||||
deployment-on-heroku
|
deployment-on-heroku
|
||||||
deployment-with-docker
|
deployment-with-docker
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
PostgreSQL Installation Basics
|
|
||||||
==============================
|
|
||||||
|
|
||||||
.. index:: pip, virtualenv, PostgreSQL
|
|
||||||
|
|
||||||
The steps below will get you up and running with PostgreSQL. This assumes you have pip and virtualenv_ installed.
|
|
||||||
|
|
||||||
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
|
|
||||||
|
|
||||||
On Mac
|
|
||||||
|
|
||||||
Install PostgreSQLapp_ from the browser and move PostGresSQL into your applications folder. Then install PostgreSQL from HomeBrew_.
|
|
||||||
|
|
||||||
$ brew install postgres
|
|
||||||
|
|
||||||
.. _PostgreSQLapp: http://postgresapp.com/
|
|
||||||
.. _HomeBrew: http://brew.sh/
|
|
|
@ -5,9 +5,9 @@ Linters
|
||||||
|
|
||||||
|
|
||||||
flake8
|
flake8
|
||||||
-------
|
------
|
||||||
|
|
||||||
To run flake8:
|
To run flake8: ::
|
||||||
|
|
||||||
$ flake8
|
$ flake8
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ The config for flake8 is located in setup.cfg. It specifies:
|
||||||
pylint
|
pylint
|
||||||
------
|
------
|
||||||
|
|
||||||
This is included in flake8's checks, but you can also run it separately to see a more detailed report:
|
This is included in flake8's checks, but you can also run it separately to see a more detailed report: ::
|
||||||
|
|
||||||
$ pylint <python files that you wish to lint>
|
$ pylint <python files that you wish to lint>
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ The config for pylint is located in .pylintrc. It specifies:
|
||||||
* max-parents=13
|
* max-parents=13
|
||||||
|
|
||||||
pycodestyle
|
pycodestyle
|
||||||
-----
|
-----------
|
||||||
|
|
||||||
This is included in flake8's checks, but you can also run it separately to see a more detailed report:
|
This is included in flake8's checks, but you can also run it separately to see a more detailed report: ::
|
||||||
|
|
||||||
$ pycodestyle <python files that you wish to lint>
|
$ pycodestyle <python files that you wish to lint>
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
|
.. _sass-compilation-live-reload:
|
||||||
|
|
||||||
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/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.. _settings:
|
.. _settings:
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
==========
|
========
|
||||||
|
|
||||||
This project relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx.
|
This project relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx.
|
||||||
|
|
||||||
|
@ -18,11 +18,10 @@ DJANGO_READ_DOT_ENV_FILE READ_DOT_ENV_FILE False
|
||||||
======================================= =========================== ============================================== ======================================================================
|
======================================= =========================== ============================================== ======================================================================
|
||||||
Environment Variable Django Setting Development Default Production Default
|
Environment Variable Django Setting Development Default Production Default
|
||||||
======================================= =========================== ============================================== ======================================================================
|
======================================= =========================== ============================================== ======================================================================
|
||||||
|
DATABASE_URL DATABASES auto w/ Docker; postgres://project_slug w/o raises error
|
||||||
DJANGO_ADMIN_URL n/a 'admin/' raises error
|
DJANGO_ADMIN_URL n/a 'admin/' raises error
|
||||||
DJANGO_CACHES CACHES (default) locmem redis
|
|
||||||
DJANGO_DATABASES DATABASES (default) See code See code
|
|
||||||
DJANGO_DEBUG DEBUG True False
|
DJANGO_DEBUG DEBUG True False
|
||||||
DJANGO_SECRET_KEY SECRET_KEY !!!SET DJANGO_SECRET_KEY!!! raises error
|
DJANGO_SECRET_KEY SECRET_KEY auto-generated raises error
|
||||||
DJANGO_SECURE_BROWSER_XSS_FILTER SECURE_BROWSER_XSS_FILTER n/a True
|
DJANGO_SECURE_BROWSER_XSS_FILTER SECURE_BROWSER_XSS_FILTER n/a True
|
||||||
DJANGO_SECURE_SSL_REDIRECT SECURE_SSL_REDIRECT n/a True
|
DJANGO_SECURE_SSL_REDIRECT SECURE_SSL_REDIRECT n/a True
|
||||||
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF SECURE_CONTENT_TYPE_NOSNIFF n/a True
|
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF SECURE_CONTENT_TYPE_NOSNIFF n/a True
|
||||||
|
@ -41,6 +40,7 @@ The following table lists settings and their defaults for third-party applicatio
|
||||||
======================================= =========================== ============================================== ======================================================================
|
======================================= =========================== ============================================== ======================================================================
|
||||||
Environment Variable Django Setting Development Default Production Default
|
Environment Variable Django Setting Development Default Production Default
|
||||||
======================================= =========================== ============================================== ======================================================================
|
======================================= =========================== ============================================== ======================================================================
|
||||||
|
CELERY_BROKER_URL CELERY_BROKER_URL auto w/ Docker; raises error w/o raises error
|
||||||
DJANGO_AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID n/a raises error
|
DJANGO_AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID n/a raises error
|
||||||
DJANGO_AWS_SECRET_ACCESS_KEY AWS_SECRET_ACCESS_KEY n/a raises error
|
DJANGO_AWS_SECRET_ACCESS_KEY AWS_SECRET_ACCESS_KEY n/a raises error
|
||||||
DJANGO_AWS_STORAGE_BUCKET_NAME AWS_STORAGE_BUCKET_NAME n/a raises error
|
DJANGO_AWS_STORAGE_BUCKET_NAME AWS_STORAGE_BUCKET_NAME n/a raises error
|
||||||
|
@ -49,8 +49,6 @@ DJANGO_SENTRY_CLIENT SENTRY_CLIENT n/a
|
||||||
DJANGO_SENTRY_LOG_LEVEL SENTRY_LOG_LEVEL n/a logging.INFO
|
DJANGO_SENTRY_LOG_LEVEL SENTRY_LOG_LEVEL n/a logging.INFO
|
||||||
MAILGUN_API_KEY MAILGUN_ACCESS_KEY n/a raises error
|
MAILGUN_API_KEY MAILGUN_ACCESS_KEY n/a raises error
|
||||||
MAILGUN_DOMAIN MAILGUN_SENDER_DOMAIN n/a raises error
|
MAILGUN_DOMAIN MAILGUN_SENDER_DOMAIN n/a raises error
|
||||||
NEW_RELIC_APP_NAME NEW_RELIC_APP_NAME n/a raises error
|
|
||||||
NEW_RELIC_LICENSE_KEY NEW_RELIC_LICENSE_KEY n/a raises error
|
|
||||||
======================================= =========================== ============================================== ======================================================================
|
======================================= =========================== ============================================== ======================================================================
|
||||||
|
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
56
docs/testing.rst
Normal file
56
docs/testing.rst
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
.. _testing:
|
||||||
|
|
||||||
|
Testing
|
||||||
|
========
|
||||||
|
|
||||||
|
We encourage users to build application tests. As best practice, this should be done immediately after documentation of the application being built, before starting on any coding.
|
||||||
|
|
||||||
|
Pytest
|
||||||
|
------
|
||||||
|
|
||||||
|
This project uses the Pytest_, a framework for easily building simple and scalable tests.
|
||||||
|
After you have set up to `develop locally`_, run the following commands to make sure the testing environment is ready: ::
|
||||||
|
|
||||||
|
$ pytest
|
||||||
|
|
||||||
|
You will get a readout of the `users` app that has already been set up with tests. If you do not want to run the `pytest` on the entire project, you can target a particular app by typing in its location: ::
|
||||||
|
|
||||||
|
$ pytest <path-to-app-in-project/app>
|
||||||
|
|
||||||
|
If you set up your project to `develop locally with docker`_, run the following command: ::
|
||||||
|
|
||||||
|
$ docker-compose -f local.yml run django pytest
|
||||||
|
|
||||||
|
Targetting particular apps for testing in ``docker`` follows a similar pattern as previously shown above.
|
||||||
|
|
||||||
|
Coverage
|
||||||
|
--------
|
||||||
|
|
||||||
|
You should build your tests to provide the highest level of **code coverage**. You can run the ``pytest`` with code ``coverage`` by typing in the following command: ::
|
||||||
|
|
||||||
|
$ docker-compose -f local.yml run django coverage run -m pytest
|
||||||
|
|
||||||
|
Once the tests are complete, in order to see the code coverage, run the following command: ::
|
||||||
|
|
||||||
|
$ docker-compose -f local.yml run django coverage report
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
At the root of the project folder, you will find the `pytest.ini` file. You can use this to customize_ the ``pytest`` to your liking.
|
||||||
|
|
||||||
|
There is also the `.coveragerc`. This is the configuration file for the ``coverage`` tool. You can find out more about `configuring`_ ``coverage``.
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
|
||||||
|
For unit tests, run: ::
|
||||||
|
|
||||||
|
$ python manage.py test
|
||||||
|
|
||||||
|
Since this is a fresh install, and there are no tests built using the Python `unittest`_ library yet, you should get feedback that says there were no tests carried out.
|
||||||
|
|
||||||
|
.. _Pytest: https://docs.pytest.org/en/latest/example/simple.html
|
||||||
|
.. _develop locally: ../developing-locally.rst
|
||||||
|
.. _develop locally with docker: ..../developing-locally-docker.rst
|
||||||
|
.. _customize: https://docs.pytest.org/en/latest/customize.html
|
||||||
|
.. _unittest: https://docs.python.org/3/library/unittest.html#module-unittest
|
||||||
|
.. _configuring: https://coverage.readthedocs.io/en/v4.5.x/config.html
|
|
@ -71,6 +71,9 @@ def remove_utility_files():
|
||||||
def remove_heroku_files():
|
def remove_heroku_files():
|
||||||
file_names = ["Procfile", "runtime.txt", "requirements.txt"]
|
file_names = ["Procfile", "runtime.txt", "requirements.txt"]
|
||||||
for file_name in file_names:
|
for file_name in file_names:
|
||||||
|
if file_name == "requirements.txt" and "{{ cookiecutter.use_travisci }}".lower() == "y":
|
||||||
|
# don't remove the file if we are using travisci but not using heroku
|
||||||
|
continue
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,9 +121,11 @@ def generate_random_string(
|
||||||
if using_ascii_letters:
|
if using_ascii_letters:
|
||||||
symbols += string.ascii_letters
|
symbols += string.ascii_letters
|
||||||
if using_punctuation:
|
if using_punctuation:
|
||||||
symbols += string.punctuation.replace('"', "").replace("'", "").replace(
|
all_punctuation = set(string.punctuation)
|
||||||
"\\", ""
|
# These symbols can cause issues in environment variables
|
||||||
)
|
unsuitable = {"'", '"', "\\", "$"}
|
||||||
|
suitable = all_punctuation.difference(unsuitable)
|
||||||
|
symbols += "".join(suitable)
|
||||||
return "".join([random.choice(symbols) for _ in range(length)])
|
return "".join([random.choice(symbols) for _ in range(length)])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ binaryornot==0.4.4
|
||||||
|
|
||||||
# Code quality
|
# Code quality
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
flake8==3.5.0
|
flake8==3.6.0
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
tox==3.2.1
|
tox==3.5.3
|
||||||
pytest==3.7.3
|
pytest==4.0.1
|
||||||
pytest-cookies==0.3.0
|
pytest-cookies==0.3.0
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# General
|
# General
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
USE_DOCKER=yes
|
USE_DOCKER=yes
|
||||||
|
IPYTHONDIR=/app/.ipython
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
5
{{cookiecutter.project_slug}}/.gitignore
vendored
5
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -333,6 +333,7 @@ tags
|
||||||
[Ss]cripts
|
[Ss]cripts
|
||||||
pyvenv.cfg
|
pyvenv.cfg
|
||||||
pip-selfcheck.json
|
pip-selfcheck.json
|
||||||
|
.env
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
### Project template
|
### Project template
|
||||||
|
@ -342,3 +343,7 @@ MailHog
|
||||||
{{ cookiecutter.project_slug }}/media/
|
{{ cookiecutter.project_slug }}/media/
|
||||||
|
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
|
|
||||||
|
{% if cookiecutter.use_docker == 'y' %}
|
||||||
|
.ipython/
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -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 %}
|
||||||
|
|
|
@ -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 %} {
|
||||||
|
@ -7,6 +7,7 @@ www.{% raw %}{$DOMAIN_NAME}{% endraw %} {
|
||||||
header_upstream Host {host}
|
header_upstream Host {host}
|
||||||
header_upstream X-Real-IP {remote}
|
header_upstream X-Real-IP {remote}
|
||||||
header_upstream X-Forwarded-Proto {scheme}
|
header_upstream X-Forwarded-Proto {scheme}
|
||||||
|
header_upstream X-CSRFToken {~csrftoken}
|
||||||
}
|
}
|
||||||
log stdout
|
log stdout
|
||||||
errors stdout
|
errors stdout
|
||||||
|
|
|
@ -209,6 +209,17 @@ FIXTURE_DIRS = (
|
||||||
str(APPS_DIR.path('fixtures')),
|
str(APPS_DIR.path('fixtures')),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# SECURITY
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-httponly
|
||||||
|
SESSION_COOKIE_HTTPONLY = True
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-httponly
|
||||||
|
CSRF_COOKIE_HTTPONLY = True
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-browser-xss-filter
|
||||||
|
SECURE_BROWSER_XSS_FILTER = True
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options
|
||||||
|
X_FRAME_OPTIONS = 'DENY'
|
||||||
|
|
||||||
# EMAIL
|
# EMAIL
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
||||||
|
|
|
@ -41,12 +41,8 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
|
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure
|
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure
|
||||||
SESSION_COOKIE_SECURE = True
|
SESSION_COOKIE_SECURE = True
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-httponly
|
|
||||||
SESSION_COOKIE_HTTPONLY = True
|
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-secure
|
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-secure
|
||||||
CSRF_COOKIE_SECURE = True
|
CSRF_COOKIE_SECURE = True
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-httponly
|
|
||||||
CSRF_COOKIE_HTTPONLY = True
|
|
||||||
# https://docs.djangoproject.com/en/dev/topics/security/#ssl-https
|
# https://docs.djangoproject.com/en/dev/topics/security/#ssl-https
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-seconds
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-seconds
|
||||||
# TODO: set this to 60 seconds first and then to 518400 once you prove the former works
|
# TODO: set this to 60 seconds first and then to 518400 once you prove the former works
|
||||||
|
@ -57,10 +53,6 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool('DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS
|
||||||
SECURE_HSTS_PRELOAD = env.bool('DJANGO_SECURE_HSTS_PRELOAD', default=True)
|
SECURE_HSTS_PRELOAD = env.bool('DJANGO_SECURE_HSTS_PRELOAD', default=True)
|
||||||
# https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff
|
# https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff
|
||||||
SECURE_CONTENT_TYPE_NOSNIFF = env.bool('DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
|
SECURE_CONTENT_TYPE_NOSNIFF = env.bool('DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-browser-xss-filter
|
|
||||||
SECURE_BROWSER_XSS_FILTER = True
|
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options
|
|
||||||
X_FRAME_OPTIONS = 'DENY'
|
|
||||||
|
|
||||||
# STORAGES
|
# STORAGES
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -86,23 +78,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 +156,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' -%}
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
"version": "{{ cookiecutter.version }}",
|
"version": "{{ cookiecutter.version }}",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
{% if cookiecutter.js_task_runner == 'Gulp' %}
|
{% if cookiecutter.js_task_runner == 'Gulp' -%}
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
{% if cookiecutter.custom_bootstrap_compilation == 'y' -%}
|
||||||
"bootstrap": "4.1.1",
|
"bootstrap": "4.1.1",
|
||||||
{% endif %}
|
{% endif -%}
|
||||||
"browser-sync": "^2.14.0",
|
"browser-sync": "^2.14.0",
|
||||||
"del": "^2.2.2",
|
"del": "^2.2.2",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-autoprefixer": "^5.0.0",
|
"gulp-autoprefixer": "^5.0.0",
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
{% if cookiecutter.custom_bootstrap_compilation == 'y' -%}
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
{% endif %}
|
{% endif -%}
|
||||||
"gulp-cssnano": "^2.1.2",
|
"gulp-cssnano": "^2.1.2",
|
||||||
"gulp-imagemin": "^4.1.0",
|
"gulp-imagemin": "^4.1.0",
|
||||||
"gulp-pixrem": "^1.0.0",
|
"gulp-pixrem": "^1.0.0",
|
||||||
|
@ -22,19 +22,19 @@
|
||||||
"gulp-sass": "^3.1.0",
|
"gulp-sass": "^3.1.0",
|
||||||
"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"
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.0"
|
"node": ">=0.8.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
{% if cookiecutter.js_task_runner == 'Gulp' %}
|
{% if cookiecutter.js_task_runner == 'Gulp' -%}
|
||||||
"dev": "gulp"
|
"dev": "gulp"
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
pytz==2018.5 # https://github.com/stub42/pytz
|
pytz==2018.7 # 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.3.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.2 # https://github.com/evansd/whitenoise
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
redis>=2.10.5 # https://github.com/antirez/redis
|
redis>=2.10.6, < 3 # pyup: < 3 # https://github.com/antirez/redis
|
||||||
{%- if cookiecutter.use_celery == "y" %}
|
{%- if cookiecutter.use_celery == "y" %}
|
||||||
celery==4.2.1 # pyup: <5.0 # https://github.com/celery/celery
|
celery==4.2.1 # pyup: < 5.0 # https://github.com/celery/celery
|
||||||
{%- if cookiecutter.use_docker == 'y' %}
|
{%- if cookiecutter.use_docker == 'y' %}
|
||||||
flower==0.9.2 # https://github.com/mher/flower
|
flower==0.9.2 # https://github.com/mher/flower
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -18,16 +18,16 @@ flower==0.9.2 # https://github.com/mher/flower
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
django==2.0.8 # pyup: < 2.1 # https://www.djangoproject.com/
|
django==2.0.9 # pyup: < 2.1 # 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.1.2 # https://github.com/jazzband/django-model-utils
|
django-model-utils==3.1.2 # https://github.com/jazzband/django-model-utils
|
||||||
django-allauth==0.37.1 # https://github.com/pennersr/django-allauth
|
django-allauth==0.38.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.2 # https://github.com/django-compressor/django-compressor
|
django-compressor==2.2 # https://github.com/django-compressor/django-compressor
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
django-redis==4.9.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.8.2 # https://github.com/encode/django-rest-framework
|
djangorestframework==3.9.0 # 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
|
||||||
|
|
|
@ -2,29 +2,29 @@
|
||||||
|
|
||||||
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.2 # 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 %}
|
||||||
psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2
|
psycopg2-binary==2.7.6.1 # https://github.com/psycopg/psycopg2
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
mypy==0.620 # https://github.com/python/mypy
|
mypy==0.641 # https://github.com/python/mypy
|
||||||
pytest==3.7.3 # https://github.com/pytest-dev/pytest
|
pytest==4.0.1 # https://github.com/pytest-dev/pytest
|
||||||
pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar
|
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
|
||||||
|
|
||||||
# Code quality
|
# Code quality
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
flake8==3.5.0 # https://github.com/PyCQA/flake8
|
flake8==3.6.0 # https://github.com/PyCQA/flake8
|
||||||
coverage==4.5.1 # https://github.com/nedbat/coveragepy
|
coverage==4.5.2 # https://github.com/nedbat/coveragepy
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
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.4 # 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.4 # https://github.com/pytest-dev/pytest-django
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
-r ./base.txt
|
-r ./base.txt
|
||||||
|
|
||||||
gunicorn==19.8.1 # https://github.com/benoitc/gunicorn
|
gunicorn==19.9.0 # https://github.com/benoitc/gunicorn
|
||||||
psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2
|
psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2
|
||||||
{%- if cookiecutter.use_whitenoise == 'n' %}
|
{%- if cookiecutter.use_whitenoise == 'n' %}
|
||||||
Collectfast==0.6.2 # https://github.com/antonagestam/collectfast
|
Collectfast==0.6.2 # https://github.com/antonagestam/collectfast
|
||||||
|
@ -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]==5.0 # https://github.com/anymail/django-anymail
|
|
@ -11,6 +11,11 @@ if not settings.configured:
|
||||||
|
|
||||||
|
|
||||||
app = Celery('{{cookiecutter.project_slug}}')
|
app = Celery('{{cookiecutter.project_slug}}')
|
||||||
|
# Using a string here means the worker will not have to
|
||||||
|
# pickle the object when using Windows.
|
||||||
|
# - namespace='CELERY' means all celery-related configuration keys
|
||||||
|
# should have a `CELERY_` prefix.
|
||||||
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||||
|
|
||||||
|
|
||||||
class CeleryAppConfig(AppConfig):
|
class CeleryAppConfig(AppConfig):
|
||||||
|
@ -18,11 +23,6 @@ class CeleryAppConfig(AppConfig):
|
||||||
verbose_name = 'Celery Config'
|
verbose_name = 'Celery Config'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
# Using a string here means the worker will not have to
|
|
||||||
# pickle the object when using Windows.
|
|
||||||
# - namespace='CELERY' means all celery-related configuration keys
|
|
||||||
# should have a `CELERY_` prefix.
|
|
||||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
||||||
installed_apps = [app_config.name for app_config in apps.get_app_configs()]
|
installed_apps = [app_config.name for app_config in apps.get_app_configs()]
|
||||||
app.autodiscover_tasks(lambda: installed_apps, force=True)
|
app.autodiscover_tasks(lambda: installed_apps, force=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user