mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-06 05:00:18 +03:00
Merge remote-tracking branch 'upstream/master'
Add comment to local.py for changes where you want to use mailhog without docker
This commit is contained in:
commit
6dab2800c3
|
@ -10,7 +10,6 @@ language: python
|
|||
python: 3.5
|
||||
|
||||
env:
|
||||
- TOX_ENV=py27
|
||||
- TOX_ENV=py34
|
||||
- TOX_ENV=py35
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ To run all tests using various versions of python in virtualenvs defined in tox.
|
|||
It is possible to tests with some versions of python, to do this the command
|
||||
is::
|
||||
|
||||
$ tox -e py27,py34
|
||||
$ tox -e py34,py35
|
||||
|
||||
Will run py.test with the python2.7, and python3.4 interpreters, for
|
||||
Will run py.test with the python3.4, and python3.5 interpreters, for
|
||||
example.
|
||||
|
||||
To run a particular test with tox for against your current Python version::
|
||||
|
|
|
@ -16,6 +16,7 @@ Fábio C. Barrionuevo da Luz `@luzfcb`_ @luzfcb
|
|||
Saurabh Kumar `@theskumar`_ @_theskumar
|
||||
Jannis Gebauer `@jayfk`_
|
||||
Burhan Khalid `@burhan`_ @burhan
|
||||
Shupeyko Nikita `@webyneter`_ @webyneter
|
||||
=========================== ============= ===========
|
||||
|
||||
*Audrey is also the creator of Cookiecutter. Audrey and
|
||||
|
@ -26,6 +27,7 @@ Daniel are on the Cookiecutter core team.*
|
|||
.. _@theskumar: https://github.com/theskumar
|
||||
.. _@audreyr: https://github.com/audreyr
|
||||
.. _@jayfk: https://github.com/jayfk
|
||||
.. _@webyneter: https://github.com/webyneter
|
||||
|
||||
Other Contributors
|
||||
------------------
|
||||
|
@ -54,10 +56,12 @@ Listed in alphabetical order.
|
|||
Areski Belaid `@areski`_
|
||||
Ashley Camba
|
||||
Barclay Gauld `@yunti`_
|
||||
Ben Warren `@bwarren2`
|
||||
Ben Lopatin
|
||||
Benjamin Abel
|
||||
Bo Lopker `@blopker`_
|
||||
Bouke Haarsma
|
||||
Brent Payne `@brentpayne`_ @brentpayne
|
||||
Burhan Khalid `@burhan`_ @burhan
|
||||
Catherine Devlin `@catherinedevlin`_
|
||||
Cédric Gaspoz `@cgaspoz`_
|
||||
|
@ -88,6 +92,7 @@ Listed in alphabetical order.
|
|||
Ian Lee `@IanLee1521`_
|
||||
Jan Van Bruggen `@jvanbrug`_
|
||||
Jens Nilsson `@phiberjenz`_
|
||||
Jimmy Gitonga `@afrowave`_ @afrowave
|
||||
Julien Almarcha `@sladinji`_
|
||||
Julio Castillo `@juliocc`_
|
||||
Kaido Kert `@kaidokert`_
|
||||
|
@ -105,11 +110,14 @@ Listed in alphabetical order.
|
|||
Lyla Fischer
|
||||
Martin Blech
|
||||
Mathijs Hoogland `@MathijsHoogland`_
|
||||
Matt Braymer-Hayes `@mattayes`_ @mattayes
|
||||
Matt Linares
|
||||
Matt Menzenski `@menzenski`_
|
||||
Matt Warren `@mfwarren`_
|
||||
Matthew Sisley `@mjsisley`_
|
||||
Meghan Heintz `@dot2dotseurat`_
|
||||
Mesut Yılmaz `@myilmaz`_
|
||||
Michael Gecht `@mimischi`_ @_mischi
|
||||
mozillazg `@mozillazg`_
|
||||
Pablo `@oubiga`_
|
||||
Parbhat Puri `@parbhat`_
|
||||
|
@ -121,19 +129,22 @@ Listed in alphabetical order.
|
|||
Roman Osipenko `@romanosipenko`_
|
||||
Russell Davies
|
||||
Sam Collins `@MightySCollins`_
|
||||
stepmr `@stepmr`_
|
||||
Shupeyko Nikita `@webyneter`_
|
||||
Sławek Ehlert `@slafs`_
|
||||
Srinivas Nyayapati `@shireenrao`_
|
||||
stepmr `@stepmr`_
|
||||
Steve Steiner `@ssteinerX`_
|
||||
Sule Marshall `@suledev`_
|
||||
Taylor Baldwin
|
||||
Théo Segonds `@show0k`_
|
||||
Tim Freund `@timfreund`_
|
||||
Tom Atkins `@knitatoms`_
|
||||
Tom Offermann
|
||||
Travis McNeill `@Travistock`_ @tavistock_esq
|
||||
Vitaly Babiy
|
||||
Vivian Guillen `@viviangb`_
|
||||
Will Farley `@goldhand`_ @g01dhand
|
||||
William Archinal `@archinal`_
|
||||
Yaroslav Halchenko
|
||||
========================== ============================ ==============
|
||||
|
||||
|
@ -145,6 +156,7 @@ Listed in alphabetical order.
|
|||
.. _@amjith: https://github.com/amjith
|
||||
.. _@andor-pierdelacabeza: https://github.com/andor-pierdelacabeza
|
||||
.. _@antoniablair: https://github.com/antoniablair
|
||||
.. _@archinal: https://github.com/archinal
|
||||
.. _@areski: https://github.com/areski
|
||||
.. _@arruda: https://github.com/arruda
|
||||
.. _@bittner: https://github.com/bittner
|
||||
|
@ -189,9 +201,12 @@ Listed in alphabetical order.
|
|||
.. _@knitatoms: https://github.com/knitatoms
|
||||
.. _@krzysztofzuraw: https://github.com/krzysztofzuraw
|
||||
.. _@MathijsHoogland: https://github.com/MathijsHoogland
|
||||
.. _@mattayes: https://github.com/mattayes
|
||||
.. _@menzenski: https://github.com/menzenski
|
||||
.. _@mfwarren: https://github.com/mfwarren
|
||||
.. _@mimischi: https://github.com/mimischi
|
||||
.. _@mjsisley: https://github.com/mjsisley
|
||||
.. _@myilmaz: https://github.com/myilmaz
|
||||
.. _@mozillazg: https://github.com/mozillazg
|
||||
.. _@noisy: https://github.com/noisy
|
||||
.. _@originell: https://github.com/originell
|
||||
|
@ -201,6 +216,7 @@ Listed in alphabetical order.
|
|||
.. _@rm--: https://github.com/rm--
|
||||
.. _@romanosipenko: https://github.com/romanosipenko
|
||||
.. _@shireenrao: https://github.com/shireenrao
|
||||
.. _@webyneter: https://github.com/webyneter
|
||||
.. _@show0k: https://github.com/show0k
|
||||
.. _@shultz: https://github.com/shultz
|
||||
.. _@siauPatrick: https://github.com/siauPatrick
|
||||
|
@ -208,6 +224,7 @@ Listed in alphabetical order.
|
|||
.. _@ssteinerX: https://github.com/ssteinerx
|
||||
.. _@stepmr: https://github.com/stepmr
|
||||
.. _@suledev: https://github.com/suledev
|
||||
.. _@timfreund: https://github.com/timfreund
|
||||
.. _@Travistock: https://github.com/Tavistock
|
||||
.. _@trungdong: https://github.com/trungdong
|
||||
.. _@viviangb: httpsL//github.com/viviangb
|
||||
|
|
65
README.rst
65
README.rst
|
@ -16,20 +16,24 @@ Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting pr
|
|||
|
||||
* Documentation: https://cookiecutter-django.readthedocs.io/en/latest/
|
||||
* See Troubleshooting_ for common errors and obstacles
|
||||
* If you have problems with Cookiecutter Django, please open issues_ before sending emails to the maintainers. You will get a much, MUCH faster response.
|
||||
|
||||
.. _cookiecutter: https://github.com/audreyr/cookiecutter
|
||||
|
||||
.. _Troubleshooting: https://cookiecutter-django.readthedocs.io/en/latest/troubleshooting.html
|
||||
|
||||
.. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373
|
||||
.. _issues: https://github.com/pydanny/cookiecutter-django/issues/new
|
||||
|
||||
Features
|
||||
---------
|
||||
|
||||
* For Django 1.10
|
||||
* Works with Python 3.4.x or 3.5.x. Python 3.6 is experimental
|
||||
* Renders Django projects with 100% starting test coverage
|
||||
* Twitter Bootstrap_ v4.0.0 - `alpha 4`_
|
||||
* Twitter Bootstrap_ v4.0.0 - alpha 6 (`maintained Foundation fork`_ also available)
|
||||
* 12-Factor_ based settings via django-environ_
|
||||
* Secure by default. We believe in SSL.
|
||||
* Optimized development and production settings
|
||||
* Registration via django-allauth_
|
||||
* Comes with custom user model ready to go
|
||||
|
@ -39,11 +43,12 @@ Features
|
|||
* Docker support using docker-compose_ for development and production
|
||||
* Procfile_ for deploying to Heroku
|
||||
* Instructions for deploying to PythonAnywhere_
|
||||
* Works with Python 2.7.x or 3.5.x
|
||||
* Run tests with unittest or py.test
|
||||
* Customizable PostgreSQL version
|
||||
* Experimental support for Amazon Elastic Beanstalk
|
||||
|
||||
.. _`maintained Foundation fork`: https://github.com/Parbhat/cookiecutter-django-foundation
|
||||
|
||||
|
||||
Optional Integrations
|
||||
---------------------
|
||||
|
@ -56,7 +61,6 @@ Optional Integrations
|
|||
* Integration with Sentry_ for error logging
|
||||
* Integration with Opbeat_ for performance monitoring
|
||||
|
||||
.. _`alpha 4`: http://blog.getbootstrap.com/2016/09/05/bootstrap-4-alpha-4/
|
||||
.. _Bootstrap: https://github.com/twbs/bootstrap
|
||||
.. _django-environ: https://github.com/joke2k/django-environ
|
||||
.. _12-Factor: http://12factor.net/
|
||||
|
@ -68,7 +72,7 @@ Optional Integrations
|
|||
.. _Celery: http://www.celeryproject.org/
|
||||
.. _Anymail: https://github.com/anymail/django-anymail
|
||||
.. _MailHog: https://github.com/mailhog/MailHog
|
||||
.. _Sentry: https://getsentry.com/welcome/
|
||||
.. _Sentry: https://sentry.io/welcome/
|
||||
.. _docker-compose: https://github.com/docker/compose
|
||||
.. _Opbeat: https://opbeat.com/
|
||||
.. _PythonAnywhere: https://www.pythonanywhere.com/
|
||||
|
@ -79,8 +83,38 @@ Constraints
|
|||
|
||||
* Only maintained 3rd party libraries are used.
|
||||
* Uses PostgreSQL everywhere (9.2+)
|
||||
* Environment variables for configuration (This won't work with Apache/mod_wsgi).
|
||||
* Environment variables for configuration (This won't work with Apache/mod_wsgi except on AWS ELB).
|
||||
|
||||
Support this Project!
|
||||
----------------------
|
||||
|
||||
This project is run by volunteers. Please support them in their efforts to maintain and improve Cookiecutter Django:
|
||||
|
||||
* https://www.patreon.com/danielroygreenfeld: Project lead. Expertise in AWS ELB and Django.
|
||||
|
||||
Projects that provide financial support to the maintainers:
|
||||
|
||||
Two Scoops of Django 1.11
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. image:: https://cdn.shopify.com/s/files/1/0304/6901/files/tsd-111-alpha-470x235.jpg?2934688328290951771
|
||||
:name: Two Scoops of Django 1.11 Cover
|
||||
:align: center
|
||||
:alt: Two Scoops of Django
|
||||
:target: http://twoscoopspress.org/products/two-scoops-of-django-1-11
|
||||
|
||||
Two Scoops of Django is the best dairy-themed Django reference in the universe
|
||||
|
||||
pyup
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. image:: https://pyup.io/static/images/logo.png
|
||||
:name: pyup
|
||||
:align: center
|
||||
:alt: pyup
|
||||
:target: https://pyup.io/
|
||||
|
||||
Pyup brings you automated security and dependency updates used by Google and other organizations. Free for open source projects!
|
||||
|
||||
Usage
|
||||
------
|
||||
|
@ -123,7 +157,6 @@ Answer the prompts with your own desired options_. For example::
|
|||
use_opbeat [n]: y
|
||||
use_pycharm [n]: y
|
||||
windows [n]: n
|
||||
use_python3 [y]: y
|
||||
use_docker [y]: n
|
||||
use_heroku [n]: y
|
||||
use_compressor [n]: y
|
||||
|
@ -136,8 +169,7 @@ Answer the prompts with your own desired options_. For example::
|
|||
Select js_task_runner:
|
||||
1 - Gulp
|
||||
2 - Grunt
|
||||
3 - Webpack
|
||||
4 - None
|
||||
3 - None
|
||||
Choose from 1, 2, 3, 4 [1]: 1
|
||||
use_lets_encrypt [n]: n
|
||||
Select open_source_license:
|
||||
|
@ -189,6 +221,13 @@ For Readers of Two Scoops of Django 1.8
|
|||
|
||||
You may notice that some elements of this project do not exactly match what we describe in chapter 3. The reason for that is this project, amongst other things, serves as a test bed for trying out new ideas and concepts. Sometimes they work, sometimes they don't, but the end result is that it won't necessarily match precisely what is described in the book I co-authored.
|
||||
|
||||
For pyup.io Users
|
||||
-----------------
|
||||
|
||||
If you are using `pyup.io`_ to keep your dependencies updated and secure, use the code *cookiecutter* during checkout to get 15% off every month.
|
||||
|
||||
.. _`pyup.io`: https://pyup.io
|
||||
|
||||
"Your Stuff"
|
||||
-------------
|
||||
|
||||
|
@ -249,15 +288,5 @@ Code of Conduct
|
|||
Everyone interacting in the Cookiecutter project's codebases, issue trackers, chat
|
||||
rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_.
|
||||
|
||||
Support This Project
|
||||
---------------------------
|
||||
|
||||
This project is maintained by volunteers. Support their efforts by spreading the word about:
|
||||
|
||||
.. image:: https://s3.amazonaws.com/tsacademy/images/tsa-logo-250x60-transparent-01.png
|
||||
:name: Two Scoops Academy
|
||||
:align: center
|
||||
:alt: Two Scoops Academy
|
||||
:target: https://twoscoops.academy/
|
||||
|
||||
.. _`PyPA Code of Conduct`: https://www.pypa.io/en/latest/code-of-conduct/
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
"use_opbeat": "n",
|
||||
"use_pycharm": "n",
|
||||
"windows": "n",
|
||||
"use_python3": "y",
|
||||
"use_docker": "y",
|
||||
"use_docker": "n",
|
||||
"use_heroku": "n",
|
||||
"use_elasticbeanstalk_experimental": "n",
|
||||
"use_compressor": "n",
|
||||
"postgresql_version": ["9.5", "9.4", "9.3", "9.2"],
|
||||
"postgresql_version": ["9.6", "9.5", "9.4", "9.3", "9.2"],
|
||||
"js_task_runner": ["Gulp", "Grunt", "None"],
|
||||
"use_lets_encrypt": "n",
|
||||
"custom_bootstrap_compilation": "n",
|
||||
"open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# cookiecutter-django documentation build configuration file.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
|
@ -10,8 +8,6 @@
|
|||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from datetime import datetime
|
||||
import os
|
||||
import sys
|
||||
|
|
|
@ -3,7 +3,7 @@ Deployment on Heroku
|
|||
|
||||
.. index:: Heroku
|
||||
|
||||
You can either push the 'deploy' button in your generated README.rst or run these commands to deploy the project to Heroku:
|
||||
Run these commands to deploy the project to Heroku:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ Make sure your project is fully commited and pushed up to Bitbucket or Github or
|
|||
|
||||
git clone <my-repo-url> # you can also use hg
|
||||
cd my-project-name
|
||||
mkvirtualenv --python=/usr/bin/python3.5 my-project-name # or python2.7, etc
|
||||
mkvirtualenv --python=/usr/bin/python3.5 my-project-name
|
||||
pip install -r requirements/production.txt # may take a few minutes
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ Generate a secret key for yourself, eg like this:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
python -c 'import random; print("".join(random.SystemRandom().choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for _ in range(50)))'
|
||||
python -c 'import random;import string; print("".join(random.SystemRandom().choice(string.digits + string.ascii_letters + string.punctuation) for _ in range(50)))'
|
||||
|
||||
Make a note of it, since we'll need it here in the console and later on in the web app config tab.
|
||||
|
||||
|
@ -140,6 +140,7 @@ Click through to the **WSGI configuration file** link (near the top) and edit th
|
|||
os.environ['DJANGO_ADMIN_URL'] = '<as above>'
|
||||
os.environ['DJANGO_MAILGUN_API_KEY'] = '<as above>'
|
||||
os.environ['DJANGO_MAILGUN_SERVER_NAME'] = '<as above>'
|
||||
os.environ['MAILGUN_SENDER_DOMAIN'] = '<as above>'
|
||||
os.environ['DJANGO_AWS_ACCESS_KEY_ID'] = ''
|
||||
os.environ['DJANGO_AWS_SECRET_ACCESS_KEY'] = ''
|
||||
os.environ['DJANGO_AWS_STORAGE_BUCKET_NAME'] = ''
|
||||
|
@ -179,5 +180,3 @@ For subsequent deployments, the procedure is much simpler. In a Bash console:
|
|||
And then go to the Web tab and hit **Reload**
|
||||
|
||||
**TIP:** *if you're really keen, you can set up git-push based deployments: https://blog.pythonanywhere.com/87/*
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,28 @@ root directory of this project as a starting point. Add your own variables to th
|
|||
file won't be tracked by git by default so you'll have to make sure to use some other mechanism to copy your secret if
|
||||
you are relying solely on git.
|
||||
|
||||
It is **highly recommended** that before you build your production application, you set your POSTGRES_USER value here. This will create a non-default user for the postgres image. If you do not set this user before building the application, the default user 'postgres' will be created, and this user will not be able to create or restore backups.
|
||||
|
||||
To obtain logs and information about crashes in a production setup, make sure that you have access to an external Sentry instance (e.g. by creating an account with `sentry.io`_), and set the `DJANGO_SENTRY_DSN` variable. This should be enough to report crashes to Sentry.
|
||||
|
||||
You will probably also need to setup the Mail backend, for example by adding a `Mailgun`_ API key and a `Mailgun`_ sender domain, otherwise, the account creation view will crash and result in a 500 error when the backend attempts to send an email to the account owner.
|
||||
|
||||
.. _sentry.io: https://sentry.io/welcome
|
||||
.. _Mailgun: https://mailgun.com
|
||||
|
||||
HTTPS is on by default
|
||||
----------------------
|
||||
|
||||
SSL (Secure Sockets Layer) is a standard security technology for establishing an encrypted link between a server and a client, typically in this case, a web server (website) and a browser. Not having HTTPS means that malicious network users can sniff authentication credentials between your website and end users' browser.
|
||||
|
||||
It is always better to deploy a site behind HTTPS and will become crucial as the web services extend to the IoT (Internet of Things). For this reason, we have set up a number of security defaults to help make your website secure:
|
||||
|
||||
* In the `.env.example`, we have made it simpler for you to change the default `Django Admin` into a custom name through an environmental variable. This should make it harder to guess the access to the admin panel.
|
||||
|
||||
* If you are not using a subdomain of the domain name set in the project, then remember to put the your staging/production IP address in the ``ALLOWED_HOSTS``_ environment variable before you deploy your website. Failure to do this will mean you will not have access to your website through the HTTP protocol.
|
||||
|
||||
* Access to the Django admin is set up by default to require HTTPS in production or once *live*. We recommend that you look into setting up the *Certbot and Let's Encrypt Setup* mentioned below or another HTTPS certification service.
|
||||
|
||||
Optional: nginx-proxy Setup
|
||||
---------------------------
|
||||
|
||||
|
@ -52,8 +74,7 @@ This pass all incoming requests on `nginx-proxy`_ to the nginx service your appl
|
|||
Optional: Postgres Data Volume Modifications
|
||||
---------------------------------------------
|
||||
|
||||
Postgres is saving its database files to the `postgres_data` volume by default. Change that if you wan't
|
||||
something else and make sure to make backups since this is not done automatically.
|
||||
Postgres is saving its database files to the `postgres_data` volume by default. Change that if you want something else and make sure to make backups since this is not done automatically.
|
||||
|
||||
Optional: Certbot and Let's Encrypt Setup
|
||||
------------------------------------------
|
||||
|
@ -72,13 +93,13 @@ Replace:
|
|||
|
||||
::
|
||||
|
||||
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} --text --agree-tos --email mjsisley@relawgo.com --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
|
||||
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} --test --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --preferred-challenges http-01"
|
||||
|
||||
With:
|
||||
|
||||
::
|
||||
|
||||
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} -d www.{{ cookiecutter.domain_name }} -d etc.{{ cookiecutter.domain_name }} --text --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
|
||||
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} -d www.{{ cookiecutter.domain_name }} -d etc.{{ cookiecutter.domain_name }} --test --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --preferred-challenges http-01"
|
||||
|
||||
Please be cognizant of Certbot/Letsencrypt certificate requests limits when getting this set up. The provide a test server that does not count against the limit while you are getting set up.
|
||||
|
||||
|
@ -89,8 +110,8 @@ If you would like to set up autorenewal of your certificates, the following comm
|
|||
|
||||
#!/bin/bash
|
||||
cd <project directory>
|
||||
docker-compose run --rm --name certbot certbot bash -c "sleep 6 && certbot certonly --standalone -d {{ cookiecutter.domain_name }} --text --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
|
||||
docker exec pearl_nginx_1 nginx -s reload
|
||||
docker-compose run --rm --name certbot certbot bash -c "sleep 6 && certbot certonly --standalone -d {{ cookiecutter.domain_name }} --test --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --preferred-challenges http-01"
|
||||
docker exec {{ cookiecutter.project_name }}_nginx_1 nginx -s reload
|
||||
|
||||
And then set a cronjob by running `crontab -e` and placing in it (period can be adjusted as desired)::
|
||||
|
||||
|
@ -143,7 +164,7 @@ If you have errors, you can always check your stack with `docker-compose`. Switc
|
|||
Supervisor Example
|
||||
-------------------
|
||||
|
||||
Once you are ready with your initial setup, you wan't to make sure that your application is run by a process manager to
|
||||
Once you are ready with your initial setup, you want to make sure that your application is run by a process manager to
|
||||
survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All
|
||||
it needs to do is to run `docker-compose up` in your projects root directory.
|
||||
|
||||
|
|
|
@ -20,6 +20,16 @@ If you don't already have it installed, follow the instructions for your OS:
|
|||
.. _`Docker for Windows`: https://docs.docker.com/engine/installation/windows/
|
||||
.. _`docker-engine`: https://docs.docker.com/engine/installation/
|
||||
|
||||
Attention Windows users
|
||||
-------------
|
||||
|
||||
Currently PostgreSQL (``psycopg2`` python package) is not installed inside Docker containers for Windows users, while it is required by the generated Django project. To fix this, add ``psycopg2`` to the list of requirements inside ``requirements/base.txt``::
|
||||
|
||||
# Python-PostgreSQL Database Adapter
|
||||
psycopg2==2.6.2
|
||||
|
||||
Doing this will prevent the project from being installed in an Windows-only environment (thus without usage of Docker). If you want to use this project without Docker, make sure to remove ``psycopg2`` from the requirements again.
|
||||
|
||||
Build the Stack
|
||||
---------------
|
||||
|
||||
|
@ -63,6 +73,11 @@ To migrate your app and to create a superuser, run::
|
|||
|
||||
Here we specify the ``django`` container as the location to run our management commands.
|
||||
|
||||
Add your Docker development server IP
|
||||
------------------------------------
|
||||
|
||||
When ``DEBUG`` is set to `True`, the host is validated against ``['localhost', '127.0.0.1', '[::1]']``. This is adequate when running a ``virtualenv``. For Docker, in the ``config.settings.local``, add your host development server IP to ``INTERNAL_IPS`` or ``ALLOWED_HOSTS`` if the variable exists.
|
||||
|
||||
Production Mode
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -106,7 +121,7 @@ Then you may need to run the following for it to work as desired:
|
|||
|
||||
::
|
||||
|
||||
$ docker-compose run -f dev.yml --service-ports django
|
||||
$ docker-compose -f dev.yml run --service-ports django
|
||||
|
||||
|
||||
django-debug-toolbar
|
||||
|
|
|
@ -50,7 +50,7 @@ Setup your email backend
|
|||
|
||||
django-allauth sends an email to verify users (and superusers) after signup and login (if they are still not verified). To send email you need to `configure your email backend`_
|
||||
|
||||
.. _configure your email backend: http://docs.djangoproject.com/en/1.9/topics/email/#smtp-backend
|
||||
.. _configure your email backend: https://docs.djangoproject.com/en/dev/topics/email/#smtp-backend
|
||||
|
||||
In development you can (optionally) use MailHog_ for email testing. MailHog is built with Go so there are no dependencies. To use MailHog:
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ To run flake8:
|
|||
The config for flake8 is located in setup.cfg. It specifies:
|
||||
|
||||
* Set max line length to 120 chars
|
||||
* Exclude .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
* Exclude ``.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules``
|
||||
|
||||
pylint
|
||||
------
|
||||
|
@ -40,4 +40,4 @@ This is included in flake8's checks, but you can also run it separately to see a
|
|||
The config for pep8 is located in setup.cfg. It specifies:
|
||||
|
||||
* Set max line length to 120 chars
|
||||
* Exclude .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
* Exclude ``.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules``
|
||||
|
|
|
@ -25,7 +25,7 @@ version [0.1.0]
|
|||
The starting version number for your project.
|
||||
|
||||
timezone [UTC]
|
||||
Used in the common settings file for the `TIME_ZONE` value.
|
||||
Used in the base settings file for the `TIME_ZONE` value.
|
||||
|
||||
use_whitenoise [y]
|
||||
Whether to use WhiteNoise_ for static file serving.
|
||||
|
@ -54,10 +54,6 @@ use_pycharm [n]
|
|||
windows [n]
|
||||
Whether you'll be developing on Windows.
|
||||
|
||||
use_python3 [y]
|
||||
By default, the Python code generated will be for Python 3.x. But if you
|
||||
answer `n` here, it will be legacy Python 2.7 code.
|
||||
|
||||
use_docker [y]
|
||||
Whether to use Docker_, separating the app and database into separate
|
||||
containers.
|
||||
|
@ -74,8 +70,7 @@ js_task_runner [1]
|
|||
|
||||
1. Gulp_
|
||||
2. Grunt_
|
||||
3. Webpack_
|
||||
4. None
|
||||
3. None
|
||||
|
||||
use_lets_encrypt [n]
|
||||
Use `Let's Encrypt`_ as the certificate authority for this project.
|
||||
|
|
|
@ -3,7 +3,14 @@ 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.
|
||||
|
||||
For configuration purposes, the following table maps environment variables to their Django setting:
|
||||
For configuration purposes, the following table maps environment variables to their Django setting and project settings:
|
||||
|
||||
|
||||
======================================= =========================== ============================================== ======================================================================
|
||||
Environment Variable Django Setting Development Default Production Default
|
||||
======================================= =========================== ============================================== ======================================================================
|
||||
DJANGO_READ_DOT_ENV_FILE READ_DOT_ENV_FILE False False
|
||||
======================================= =========================== ============================================== ======================================================================
|
||||
|
||||
|
||||
======================================= =========================== ============================================== ======================================================================
|
||||
|
|
|
@ -12,10 +12,10 @@ A portion of this code was adopted from Django's standard crypto functions and
|
|||
utilities, specifically:
|
||||
https://github.com/django/django/blob/master/django/utils/crypto.py
|
||||
"""
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import random
|
||||
import shutil
|
||||
import string
|
||||
|
||||
# Get the root project directory
|
||||
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
|
||||
|
@ -28,16 +28,19 @@ except NotImplementedError:
|
|||
using_sysrandom = False
|
||||
|
||||
|
||||
def get_random_string(
|
||||
length=50,
|
||||
allowed_chars='abcdefghijklmnopqrstuvwxyz0123456789!@#%^&*(-_=+)'):
|
||||
def get_random_string(length=50):
|
||||
"""
|
||||
Returns a securely generated random string.
|
||||
The default length of 12 with the a-z, A-Z, 0-9 character set returns
|
||||
a 71-bit value. log_2((26+26+10)^12) =~ 71 bits
|
||||
"""
|
||||
punctuation = string.punctuation.replace('"', '').replace("'", '')
|
||||
punctuation = punctuation.replace('\\', '')
|
||||
if using_sysrandom:
|
||||
return ''.join(random.choice(allowed_chars) for i in range(length))
|
||||
return ''.join(random.choice(
|
||||
string.digits + string.ascii_letters + punctuation
|
||||
) for i in range(length))
|
||||
|
||||
print(
|
||||
"Cookiecutter Django couldn't find a secure pseudo-random number generator on your system."
|
||||
" Please change change your SECRET_KEY variables in conf/settings/local.py and env.example"
|
||||
|
@ -198,6 +201,16 @@ def remove_elasticbeanstalk():
|
|||
PROJECT_DIRECTORY, filename
|
||||
))
|
||||
|
||||
def remove_open_source_files():
|
||||
"""
|
||||
Removes files conventional to opensource projects only.
|
||||
"""
|
||||
for filename in ["CONTRIBUTORS.txt"]:
|
||||
os.remove(os.path.join(
|
||||
PROJECT_DIRECTORY, filename
|
||||
))
|
||||
|
||||
|
||||
# IN PROGRESS
|
||||
# def copy_doc_files(project_directory):
|
||||
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
|
||||
|
@ -280,3 +293,7 @@ if '{{ cookiecutter.open_source_license}}' != 'GPLv3':
|
|||
# 12. Remove Elastic Beanstalk files
|
||||
if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
|
||||
remove_elasticbeanstalk()
|
||||
|
||||
# 13. Remove files conventional to opensource projects only.
|
||||
if '{{ cookiecutter.open_source_license }}' == 'Not open source':
|
||||
remove_open_source_files()
|
|
@ -9,3 +9,23 @@ docker = '{{ cookiecutter.use_docker }}'.lower()
|
|||
|
||||
if elasticbeanstalk == 'y' and (heroku == 'y' or docker == 'y'):
|
||||
raise Exception("Cookiecutter Django's EXPERIMENTAL Elastic Beanstalk support is incompatible with Heroku and Docker setups.")
|
||||
|
||||
if docker == 'n':
|
||||
import sys
|
||||
|
||||
python_major_version = sys.version_info[0]
|
||||
|
||||
if python_major_version == 2:
|
||||
sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.4+ only. Are you sure you want to proceed? (y/n)")
|
||||
|
||||
yes_options = set(['y'])
|
||||
no_options = set(['n', ''])
|
||||
choice = raw_input().lower()
|
||||
if choice in no_options:
|
||||
sys.exit(1)
|
||||
elif choice in yes_options:
|
||||
pass
|
||||
else:
|
||||
sys.stdout.write("Please respond with %s or %s"
|
||||
% (', '.join([o for o in yes_options if not o == ''])
|
||||
, ', '.join([o for o in no_options if not o == ''])))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
cookiecutter==1.4.0
|
||||
flake8==3.0.4 # pyup: != 2.6.0
|
||||
sh==1.11
|
||||
binaryornot==0.4.0
|
||||
cookiecutter==1.5.1
|
||||
flake8==3.3.0 # pyup: != 2.6.0
|
||||
sh==1.12.14
|
||||
binaryornot==0.4.3
|
||||
|
||||
# Testing
|
||||
pytest==3.0.3
|
||||
pytest==3.1.2
|
||||
pep8==1.7.0
|
||||
pyflakes==1.3.0
|
||||
tox==2.4.1
|
||||
pyflakes==1.5.0
|
||||
tox==2.7.0
|
||||
pytest-cookies==0.2.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# These requirements prevented an upgrade to Django 1.10.
|
||||
django-coverage-plugin==1.3.1
|
||||
django-coverage-plugin==1.5.0
|
||||
django-autoslug==1.9.3
|
||||
|
||||
|
|
4
setup.py
4
setup.py
|
@ -10,7 +10,7 @@ except ImportError:
|
|||
|
||||
# Our version ALWAYS matches the version of Django we support
|
||||
# If Django has a new release, we branch, tag, then update this setting after the tag.
|
||||
version = '1.10.1'
|
||||
version = '1.10.7'
|
||||
|
||||
if sys.argv[-1] == 'tag':
|
||||
os.system('git tag -a %s -m "version %s"' % (version, version))
|
||||
|
@ -39,8 +39,6 @@ setup(
|
|||
'Natural Language :: English',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
import sh
|
||||
|
|
|
@ -11,7 +11,7 @@ mkdir -p .cache/docker
|
|||
cd .cache/docker
|
||||
|
||||
# create the project using the default settings in cookiecutter.json
|
||||
cookiecutter ../../ --no-input --overwrite-if-exists
|
||||
cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y js_task_runner=None
|
||||
cd project_name
|
||||
|
||||
# run the project's tests
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -1,6 +1,6 @@
|
|||
[tox]
|
||||
skipsdist = true
|
||||
envlist = py27,py34,py35
|
||||
envlist = py34,py35
|
||||
|
||||
[testenv]
|
||||
passenv = LC_ALL, LANG, HOME
|
||||
|
|
|
@ -24,7 +24,7 @@ Resources:
|
|||
CacheNodeType:
|
||||
Fn::GetOptionSetting:
|
||||
OptionName : "CacheNodeType"
|
||||
DefaultValue : "cache.t1.micro"
|
||||
DefaultValue : "cache.t2.micro"
|
||||
NumCacheNodes:
|
||||
Fn::GetOptionSetting:
|
||||
OptionName : "NumCacheNodes"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
option_settings:
|
||||
"aws:elasticbeanstalk:customoption":
|
||||
CacheNodeType : cache.t1.micro
|
||||
CacheNodeType : cache.t2.micro
|
||||
NumCacheNodes : 1
|
||||
Engine : redis
|
||||
CachePort : 6379
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
container_commands:
|
||||
01_setup_apache:
|
||||
command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
|
|
@ -0,0 +1,25 @@
|
|||
# mod_deflate configuration
|
||||
<IfModule mod_deflate.c>
|
||||
# Restrict compression to these MIME types
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE application/xhtml+xml
|
||||
AddOutputFilterByType DEFLATE text/xml
|
||||
AddOutputFilterByType DEFLATE application/xml
|
||||
AddOutputFilterByType DEFLATE application/xml+rss
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/javascript
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
# Level of compression (Highest 9 - Lowest 1)
|
||||
DeflateCompressionLevel 9
|
||||
# Netscape 4.x has some problems.
|
||||
BrowserMatch ^Mozilla/4 gzip-only-text/html
|
||||
# Netscape 4.06-4.08 have some more problems
|
||||
BrowserMatch ^Mozilla/4\.0[678] no-gzip
|
||||
# MSIE masquerades as Netscape, but it is fine
|
||||
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
|
||||
<IfModule mod_headers.c>
|
||||
# Make sure proxies don't deliver the wrong content
|
||||
Header append Vary User-Agent env=!dont-vary
|
||||
</IfModule>
|
||||
</IfModule>
|
3
{{cookiecutter.project_slug}}/.gitignore
vendored
3
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -76,3 +76,6 @@ mailhog
|
|||
{% endif %}
|
||||
|
||||
staticfiles/
|
||||
|
||||
.cache/
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
|
|
|
@ -8,8 +8,4 @@ before_install:
|
|||
- sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm
|
||||
language: python
|
||||
python:
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
- "3.5"
|
||||
{% else %}
|
||||
- "2.7"
|
||||
{%- endif %}
|
||||
|
|
|
@ -60,6 +60,9 @@ module.exports = function (grunt) {
|
|||
dev: {
|
||||
options: {
|
||||
outputStyle: 'nested',
|
||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
||||
includePaths: ['bower_components/bootstrap-sass/assets/stylesheets/bootstrap/'],
|
||||
{% endif %}
|
||||
sourceMap: false,
|
||||
precision: 10
|
||||
},
|
||||
|
@ -70,6 +73,9 @@ module.exports = function (grunt) {
|
|||
dist: {
|
||||
options: {
|
||||
outputStyle: 'compressed',
|
||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
||||
includePaths: ['bower_components/bootstrap-sass/assets/stylesheets/bootstrap/'],
|
||||
{% endif %}
|
||||
sourceMap: false,
|
||||
precision: 10
|
||||
},
|
||||
|
|
|
@ -107,7 +107,7 @@ The email server will exit when you exit the Grunt task on the CLI with Ctrl+C.
|
|||
Sentry
|
||||
^^^^^^
|
||||
|
||||
Sentry is an error logging aggregator service. You can sign up for a free account at https://getsentry.com/signup/?code=cookiecutter or download and host it yourself.
|
||||
Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself.
|
||||
The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.
|
||||
|
||||
You must set the DSN url in production.
|
||||
|
@ -145,3 +145,12 @@ See detailed `cookiecutter-django Elastic Beanstalk documentation`_.
|
|||
.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-elastic-beanstalk.html
|
||||
|
||||
{% endif %}
|
||||
{% if cookiecutter.custom_bootstrap_compilation == "y" %}
|
||||
Custom Bootstrap Compilation
|
||||
^^^^^^
|
||||
|
||||
To get automatic Bootstrap recompilation with variables of your choice, install bootstrap sass (`bower install bootstrap-sass`) and tweak your variables in `static/sass/custom_bootstrap_vars`.
|
||||
|
||||
(You can find a list of available variables [in the bootstrap-sass source](https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss), or get explanations on them in the [Bootstrap docs](https://getbootstrap.com/customize/).)
|
||||
|
||||
{% endif %}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
FROM python:3.5
|
||||
{% else %}
|
||||
FROM python:2.7
|
||||
{%- endif %}
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
RUN groupadd -r django \
|
||||
&& useradd -r -g django django
|
||||
|
||||
# Requirements have to be pulled and installed here, otherwise caching won't work
|
||||
COPY ./requirements /requirements
|
||||
RUN pip install --no-cache-dir -r /requirements/production.txt \
|
||||
&& rm -rf /requirements
|
||||
|
||||
RUN pip install -r /requirements/production.txt \
|
||||
&& groupadd -r django \
|
||||
&& useradd -r -g django django
|
||||
|
||||
COPY . /app
|
||||
RUN chown -R django /app
|
||||
|
||||
COPY ./compose/django/gunicorn.sh /gunicorn.sh
|
||||
COPY ./compose/django/entrypoint.sh /entrypoint.sh
|
||||
COPY ./compose/django/gunicorn.sh ./compose/django/entrypoint.sh /
|
||||
RUN sed -i 's/\r//' /entrypoint.sh \
|
||||
&& sed -i 's/\r//' /gunicorn.sh \
|
||||
&& chmod +x /entrypoint.sh \
|
||||
|
@ -24,6 +18,12 @@ RUN sed -i 's/\r//' /entrypoint.sh \
|
|||
&& chmod +x /gunicorn.sh \
|
||||
&& chown django /gunicorn.sh
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN chown -R django /app
|
||||
|
||||
USER django
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
FROM python:3.5
|
||||
{% else %}
|
||||
FROM python:2.7
|
||||
{%- endif %}
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Requirements have to be pulled and installed here, otherwise caching won't work
|
||||
|
|
|
@ -2,6 +2,9 @@ FROM nginx:latest
|
|||
ADD nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
{% if cookiecutter.use_lets_encrypt == 'y' and cookiecutter.use_docker == 'y' %}
|
||||
# installs the `ps` command in the nginx image
|
||||
RUN apt-get update && apt-get install -y procps
|
||||
|
||||
ADD start.sh /start.sh
|
||||
ADD nginx-secure.conf /etc/nginx/nginx-secure.conf
|
||||
ADD dhparams.pem /etc/ssl/private/dhparams.pem
|
||||
|
|
|
@ -11,7 +11,7 @@ events {
|
|||
|
||||
http {
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
|
@ -32,57 +32,57 @@ http {
|
|||
upstream app {
|
||||
server django:5000;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name ___my.example.com___ www.___my.example.com___;
|
||||
server {
|
||||
listen 80;
|
||||
server_name ___my.example.com___ www.___my.example.com___;
|
||||
|
||||
location /.well-known/acme-challenge {
|
||||
# Since the certbot container isn't up constantly, need to resolve ip dynamically using docker's dns
|
||||
resolver ___NAMESERVER___;
|
||||
set $certbot_addr_port certbot:80;
|
||||
proxy_pass http://$certbot_addr_port;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
location /.well-known/acme-challenge {
|
||||
# Since the certbot container isn't up constantly, need to resolve ip dynamically using docker's dns
|
||||
resolver ___NAMESERVER___;
|
||||
set $certbot_addr_port certbot:80;
|
||||
proxy_pass http://$certbot_addr_port;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
location / {
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
server_name ___my.example.com___ www.___my.example.com___;
|
||||
server {
|
||||
listen 443;
|
||||
server_name ___my.example.com___ www.___my.example.com___;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/___my.example.com___/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/___my.example.com___/privkey.pem;
|
||||
ssl_session_timeout 5m;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/___my.example.com___/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/___my.example.com___/privkey.pem;
|
||||
ssl_session_timeout 5m;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_dhparam /etc/ssl/private/dhparams.pem;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_dhparam /etc/ssl/private/dhparams.pem;
|
||||
|
||||
location /.well-known/acme-challenge {
|
||||
resolver ___NAMESERVER___;
|
||||
set $certbot_addr_port certbot:443;
|
||||
proxy_pass http://$certbot_addr_port;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
location /.well-known/acme-challenge {
|
||||
resolver ___NAMESERVER___;
|
||||
set $certbot_addr_port certbot:443;
|
||||
proxy_pass http://$certbot_addr_port;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
|
||||
location / {
|
||||
location / {
|
||||
# checks for static file, if not found proxy to app
|
||||
try_files $uri @proxy_to_app;
|
||||
}
|
||||
|
||||
# cookiecutter-django app
|
||||
location @proxy_to_app {
|
||||
# cookiecutter-django app
|
||||
location @proxy_to_app {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
|
@ -91,6 +91,6 @@ http {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Django settings for {{cookiecutter.project_name}} project.
|
||||
|
||||
|
@ -8,18 +7,29 @@ https://docs.djangoproject.com/en/dev/topics/settings/
|
|||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/dev/ref/settings/
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import environ
|
||||
|
||||
ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config/settings/common.py - 3 = {{ cookiecutter.project_slug }}/)
|
||||
ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/)
|
||||
APPS_DIR = ROOT_DIR.path('{{ cookiecutter.project_slug }}')
|
||||
|
||||
# Load operating system environment variables and then prepare to use them
|
||||
env = environ.Env()
|
||||
|
||||
# .env file, should load only in development environment
|
||||
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
|
||||
|
||||
if READ_DOT_ENV_FILE:
|
||||
# Operating System Environment variables have precedence over variables defined in the .env file,
|
||||
# that is to say variables from the .env files will only be used if not defined
|
||||
# as environment variables.
|
||||
env_file = str(ROOT_DIR.path('.env'))
|
||||
print('Loading : {}'.format(env_file))
|
||||
env.read_env(env_file)
|
||||
print('The .env file has been loaded. See base.py for more information')
|
||||
|
||||
# APP CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
DJANGO_APPS = (
|
||||
DJANGO_APPS = [
|
||||
# Default Django apps:
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -33,27 +43,27 @@ DJANGO_APPS = (
|
|||
|
||||
# Admin
|
||||
'django.contrib.admin',
|
||||
)
|
||||
THIRD_PARTY_APPS = (
|
||||
]
|
||||
THIRD_PARTY_APPS = [
|
||||
'crispy_forms', # Form layouts
|
||||
'allauth', # registration
|
||||
'allauth.account', # registration
|
||||
'allauth.socialaccount', # registration
|
||||
)
|
||||
]
|
||||
|
||||
# Apps specific for this project go here.
|
||||
LOCAL_APPS = (
|
||||
LOCAL_APPS = [
|
||||
# custom users app
|
||||
'{{ cookiecutter.project_slug }}.users.apps.UsersConfig',
|
||||
# Your stuff: custom apps go here
|
||||
)
|
||||
]
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
|
||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
||||
|
||||
# MIDDLEWARE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
MIDDLEWARE = (
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
|
@ -61,7 +71,7 @@ MIDDLEWARE = (
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
]
|
||||
|
||||
# MIGRATIONS CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -88,9 +98,9 @@ EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.s
|
|||
# MANAGER CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
||||
ADMINS = (
|
||||
ADMINS = [
|
||||
("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'),
|
||||
)
|
||||
]
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
|
@ -175,15 +185,15 @@ STATIC_ROOT = str(ROOT_DIR('staticfiles'))
|
|||
STATIC_URL = '/static/'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
|
||||
STATICFILES_DIRS = (
|
||||
STATICFILES_DIRS = [
|
||||
str(APPS_DIR.path('static')),
|
||||
)
|
||||
]
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
|
||||
STATICFILES_FINDERS = (
|
||||
STATICFILES_FINDERS = [
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
]
|
||||
|
||||
# MEDIA CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -200,6 +210,16 @@ ROOT_URLCONF = 'config.urls'
|
|||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
|
||||
# PASSWORD STORAGE SETTINGS
|
||||
# ------------------------------------------------------------------------------
|
||||
# See https://docs.djangoproject.com/en/dev/topics/auth/passwords/#using-argon2-with-django
|
||||
PASSWORD_HASHERS = [
|
||||
'django.contrib.auth.hashers.Argon2PasswordHasher',
|
||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
||||
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
||||
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
|
||||
'django.contrib.auth.hashers.BCryptPasswordHasher',
|
||||
]
|
||||
|
||||
# PASSWORD VALIDATION
|
||||
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
|
||||
|
@ -222,10 +242,10 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
|
||||
# AUTHENTICATION CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
)
|
||||
]
|
||||
|
||||
# Some really nice defaults
|
||||
ACCOUNT_AUTHENTICATION_METHOD = 'username'
|
||||
|
@ -246,22 +266,20 @@ LOGIN_URL = 'account_login'
|
|||
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
|
||||
{% if cookiecutter.use_celery == 'y' %}
|
||||
########## CELERY
|
||||
INSTALLED_APPS += ('{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig',)
|
||||
# if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line.
|
||||
INSTALLED_APPS += ('kombu.transport.django',)
|
||||
BROKER_URL = env('CELERY_BROKER_URL', default='django://')
|
||||
if BROKER_URL == 'django://':
|
||||
INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
|
||||
CELERY_BROKER_URL = env('CELERY_BROKER_URL', default='django://')
|
||||
if CELERY_BROKER_URL == 'django://':
|
||||
CELERY_RESULT_BACKEND = 'redis://'
|
||||
else:
|
||||
CELERY_RESULT_BACKEND = BROKER_URL
|
||||
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
||||
########## END CELERY
|
||||
{% endif %}
|
||||
|
||||
{%- if cookiecutter.use_compressor == 'y'-%}
|
||||
# django-compressor
|
||||
# ------------------------------------------------------------------------------
|
||||
INSTALLED_APPS += ("compressor", )
|
||||
STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", )
|
||||
INSTALLED_APPS += ['compressor']
|
||||
STATICFILES_FINDERS += ['compressor.finders.CompressorFinder']
|
||||
{%- endif %}
|
||||
|
||||
# Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %}
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Production Configurations
|
||||
|
||||
|
@ -12,15 +11,13 @@ Production Configurations
|
|||
- Use opbeat for error reporting
|
||||
{% endif %}
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from boto.s3.connection import OrdinaryCallingFormat
|
||||
from django.utils import six
|
||||
{% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
|
||||
import logging
|
||||
{% endif %}
|
||||
|
||||
from .common import * # noqa
|
||||
from .base import * # noqa
|
||||
|
||||
# SECRET CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -35,37 +32,35 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|||
|
||||
{%- if cookiecutter.use_sentry_for_error_reporting == 'y' %}
|
||||
# raven sentry client
|
||||
# See https://docs.getsentry.com/hosted/clients/python/integrations/django/
|
||||
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
||||
# See https://docs.sentry.io/clients/python/integrations/django/
|
||||
INSTALLED_APPS += ['raven.contrib.django.raven_compat', ]
|
||||
{% endif %}
|
||||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||
# Use Whitenoise to serve static files
|
||||
# See: https://whitenoise.readthedocs.io/
|
||||
WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', )
|
||||
WHITENOISE_MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware', ]
|
||||
MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWARE
|
||||
{% endif %}
|
||||
{%- if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
|
||||
RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', )
|
||||
RAVEN_MIDDLEWARE = ['raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware']
|
||||
MIDDLEWARE = RAVEN_MIDDLEWARE + MIDDLEWARE
|
||||
{% endif %}
|
||||
{%- if cookiecutter.use_opbeat == 'y' -%}
|
||||
# opbeat integration
|
||||
# See https://opbeat.com/languages/django/
|
||||
INSTALLED_APPS += ('opbeat.contrib.django',)
|
||||
INSTALLED_APPS += ['opbeat.contrib.django', ]
|
||||
OPBEAT = {
|
||||
'ORGANIZATION_ID': env('DJANGO_OPBEAT_ORGANIZATION_ID'),
|
||||
'APP_ID': env('DJANGO_OPBEAT_APP_ID'),
|
||||
'SECRET_TOKEN': env('DJANGO_OPBEAT_SECRET_TOKEN')
|
||||
}
|
||||
MIDDLEWARE = (
|
||||
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
|
||||
) + MIDDLEWARE
|
||||
MIDDLEWARE = ['opbeat.contrib.django.middleware.OpbeatAPMMiddleware', ] + MIDDLEWARE
|
||||
{% endif %}
|
||||
|
||||
# SECURITY CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# See https://docs.djangoproject.com/en/1.9/ref/middleware/#module-django.middleware.security
|
||||
# and https://docs.djangoproject.com/ja/1.9/howto/deployment/checklist/#run-manage-py-check-deploy
|
||||
# See https://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.security
|
||||
# and https://docs.djangoproject.com/en/dev/howto/deployment/checklist/#run-manage-py-check-deploy
|
||||
|
||||
# set this to 60 seconds and then to 518400 when you can prove it works
|
||||
SECURE_HSTS_SECONDS = 60
|
||||
|
@ -84,11 +79,11 @@ X_FRAME_OPTIONS = 'DENY'
|
|||
# SITE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# Hosts/domain names that are valid for this site
|
||||
# See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}'])
|
||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}', ])
|
||||
# END SITE CONFIGURATION
|
||||
|
||||
INSTALLED_APPS += ('gunicorn', )
|
||||
INSTALLED_APPS += ['gunicorn', ]
|
||||
|
||||
|
||||
# STORAGE CONFIGURATION
|
||||
|
@ -96,9 +91,7 @@ INSTALLED_APPS += ('gunicorn', )
|
|||
# Uploaded Media Files
|
||||
# ------------------------
|
||||
# See: http://django-storages.readthedocs.io/en/latest/index.html
|
||||
INSTALLED_APPS += (
|
||||
'storages',
|
||||
)
|
||||
INSTALLED_APPS += ['storages', ]
|
||||
|
||||
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
|
||||
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
|
||||
|
@ -113,9 +106,9 @@ AWS_EXPIRY = 60 * 60 * 24 * 7
|
|||
# TODO See: https://github.com/jschneier/django-storages/issues/47
|
||||
# Revert the following and use str after the above-mentioned bug is fixed in
|
||||
# either django-storage-redux or boto
|
||||
control = 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIRY, AWS_EXPIRY)
|
||||
AWS_HEADERS = {
|
||||
'Cache-Control': six.b('max-age=%d, s-maxage=%d, must-revalidate' % (
|
||||
AWS_EXPIRY, AWS_EXPIRY))
|
||||
'Cache-Control': bytes(control, encoding='latin-1')
|
||||
}
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT, used for managing
|
||||
|
@ -143,7 +136,7 @@ STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
|
|||
# For Django 1.7+, 'collectfast' should come before
|
||||
# 'django.contrib.staticfiles'
|
||||
AWS_PRELOAD_METADATA = True
|
||||
INSTALLED_APPS = ('collectfast', ) + INSTALLED_APPS
|
||||
INSTALLED_APPS = ['collectfast', ] + INSTALLED_APPS
|
||||
{%- endif %}
|
||||
{% if cookiecutter.use_compressor == 'y'-%}
|
||||
# COMPRESSOR
|
||||
|
@ -156,16 +149,16 @@ COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True)
|
|||
# ------------------------------------------------------------------------------
|
||||
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
|
||||
default='{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
|
||||
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}] ')
|
||||
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}]')
|
||||
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
|
||||
|
||||
# Anymail with Mailgun
|
||||
INSTALLED_APPS += ("anymail", )
|
||||
INSTALLED_APPS += ['anymail', ]
|
||||
ANYMAIL = {
|
||||
"MAILGUN_API_KEY": env('DJANGO_MAILGUN_API_KEY'),
|
||||
"MAILGUN_SENDER_DOMAIN": env('MAILGUN_SENDER_DOMAIN')
|
||||
'MAILGUN_API_KEY': env('DJANGO_MAILGUN_API_KEY'),
|
||||
'MAILGUN_SENDER_DOMAIN': env('MAILGUN_SENDER_DOMAIN')
|
||||
}
|
||||
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
|
||||
EMAIL_BACKEND = 'anymail.backends.mailgun.MailgunBackend'
|
||||
|
||||
# TEMPLATE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -199,7 +192,7 @@ DATABASES['default'] = env.db('DATABASE_URL')
|
|||
# CACHING
|
||||
# ------------------------------------------------------------------------------
|
||||
{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%}
|
||||
REDIS_LOCATION = "redis://{}:{}/0".format(
|
||||
REDIS_LOCATION = 'redis://{}:{}/0'.format(
|
||||
env('REDIS_ENDPOINT_ADDRESS'),
|
||||
env('REDIS_PORT')
|
||||
)
|
||||
|
@ -228,7 +221,7 @@ LOGGING = {
|
|||
'disable_existing_loggers': True,
|
||||
'root': {
|
||||
'level': 'WARNING',
|
||||
'handlers': ['sentry'],
|
||||
'handlers': ['sentry', ],
|
||||
},
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
|
@ -250,22 +243,22 @@ LOGGING = {
|
|||
'loggers': {
|
||||
'django.db.backends': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console'],
|
||||
'handlers': ['console', ],
|
||||
'propagate': False,
|
||||
},
|
||||
'raven': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console'],
|
||||
'handlers': ['console', ],
|
||||
'propagate': False,
|
||||
},
|
||||
'sentry.errors': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console'],
|
||||
'handlers': ['console', ],
|
||||
'propagate': False,
|
||||
},
|
||||
'django.security.DisallowedHost': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console', 'sentry'],
|
||||
'handlers': ['console', 'sentry', ],
|
||||
'propagate': False,
|
||||
},
|
||||
},
|
||||
|
@ -282,7 +275,7 @@ RAVEN_CONFIG = {
|
|||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# See https://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
|
@ -301,7 +294,7 @@ LOGGING = {
|
|||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'filters': ['require_debug_false', ],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
},
|
||||
'console': {
|
||||
|
@ -312,13 +305,13 @@ LOGGING = {
|
|||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'handlers': ['mail_admins', ],
|
||||
'level': 'ERROR',
|
||||
'propagate': True
|
||||
},
|
||||
'django.security.DisallowedHost': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console', 'mail_admins'],
|
||||
'handlers': ['console', 'mail_admins', ],
|
||||
'propagate': True
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Test settings
|
||||
|
||||
- Used to run tests fast on the continuous integration server and locally
|
||||
'''
|
||||
|
||||
from .common import * # noqa
|
||||
from .base import * # noqa
|
||||
|
||||
|
||||
# DEBUG
|
||||
|
@ -47,16 +46,16 @@ TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
|||
# PASSWORD HASHING
|
||||
# ------------------------------------------------------------------------------
|
||||
# Use fast password hasher so tests run faster
|
||||
PASSWORD_HASHERS = (
|
||||
PASSWORD_HASHERS = [
|
||||
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||
)
|
||||
]
|
||||
|
||||
# TEMPLATE LOADERS
|
||||
# ------------------------------------------------------------------------------
|
||||
# Keep templates in memory so tests run faster
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = [
|
||||
('django.template.loaders.cached.Loader', [
|
||||
['django.template.loaders.cached.Loader', [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
]),
|
||||
], ],
|
||||
]
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.conf.urls.static import static
|
||||
|
@ -35,7 +32,6 @@ if settings.DEBUG:
|
|||
]
|
||||
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
|
||||
urlpatterns += [
|
||||
urlpatterns = [
|
||||
url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
]
|
||||
] + urlpatterns
|
||||
|
|
|
@ -14,8 +14,15 @@ framework.
|
|||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
# This allows easy placement of apps within the interior
|
||||
# {{ cookiecutter.project_slug }} directory.
|
||||
app_path = os.path.dirname(os.path.abspath(__file__)).replace('/config', '')
|
||||
sys.path.append(os.path.join(app_path, '{{ cookiecutter.project_slug }}'))
|
||||
|
||||
{% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
|
||||
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
|
||||
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
|
||||
|
|
|
@ -16,7 +16,6 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: ./compose/django/Dockerfile
|
||||
user: django
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
|
@ -29,14 +28,12 @@ services:
|
|||
- django
|
||||
{% if cookiecutter.use_lets_encrypt == 'y' %}
|
||||
- certbot
|
||||
environment:
|
||||
- MY_DOMAIN_NAME={{ cookiecutter.domain_name }}
|
||||
{% endif %}
|
||||
ports:
|
||||
- "0.0.0.0:80:80"
|
||||
{% if cookiecutter.use_lets_encrypt == 'y' %}
|
||||
environment:
|
||||
- MY_DOMAIN_NAME={{ cookiecutter.domain_name }}
|
||||
ports:
|
||||
- "0.0.0.0:80:80"
|
||||
- "0.0.0.0:443:443"
|
||||
volumes:
|
||||
- /etc/letsencrypt:/etc/letsencrypt
|
||||
|
@ -44,7 +41,7 @@ services:
|
|||
|
||||
certbot:
|
||||
image: quay.io/letsencrypt/letsencrypt
|
||||
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} --text --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
|
||||
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} --test --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --preferred-challenges http-01"
|
||||
entrypoint: ""
|
||||
volumes:
|
||||
- /etc/letsencrypt:/etc/letsencrypt
|
||||
|
@ -57,13 +54,12 @@ services:
|
|||
{% endif %}
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
image: redis:3.0
|
||||
{% if cookiecutter.use_celery == 'y' %}
|
||||
celeryworker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./compose/django/Dockerfile
|
||||
user: django
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- postgres
|
||||
|
@ -74,7 +70,6 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: ./compose/django/Dockerfile
|
||||
user: django
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- postgres
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# {{ cookiecutter.project_name }} documentation build configuration file, created by
|
||||
# sphinx-quickstart.
|
||||
#
|
||||
|
@ -11,8 +9,6 @@
|
|||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ The Docker compose tool (previously known as `fig`_) makes linking these contain
|
|||
...
|
||||
docker-compose.yml
|
||||
|
||||
Each component of your application would get its own `Dockerfile`_. The rest of this example assumes you are using the `base postgres image`_ for your database. Your database settings in `config/common.py` might then look something like:
|
||||
Each component of your application would get its own `Dockerfile`_. The rest of this example assumes you are using the `base postgres image`_ for your database. Your database settings in `config/base.py` might then look something like:
|
||||
|
||||
.. _Dockerfile: https://docs.docker.com/reference/builder/
|
||||
.. _base postgres image: https://registry.hub.docker.com/_/postgres/
|
||||
|
|
|
@ -14,7 +14,7 @@ This repository comes with already prepared "Run/Debug Configurations" for docke
|
|||
|
||||
.. image:: images/2.png
|
||||
|
||||
But as you can see, at the beggining there is something wrong with them. They have red X on django icon, and they cannot be used, withot configuring remote python interpteter. To do that, you have to go to *Settings > Build, Execution, Deployment* first.
|
||||
But as you can see, at the beggining there is something wrong with them. They have red X on django icon, and they cannot be used, without configuring remote python interpteter. To do that, you have to go to *Settings > Build, Execution, Deployment* first.
|
||||
|
||||
|
||||
Next, you have to add new remote python interpreter, based on already tested deployment settings. Go to *Settings > Project > Project Interpreter*. Click on the cog icon, and click *Add Remote*.
|
||||
|
@ -48,7 +48,7 @@ After few seconds, all *Run/Debug Configurations* should be ready to use.
|
|||
* run and debug tests
|
||||
.. image:: images/f2.png
|
||||
.. image:: images/f3.png
|
||||
* run and debug migrations or different django managment commands
|
||||
* run and debug migrations or different django management commands
|
||||
.. image:: images/f4.png
|
||||
* and many others..
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ POSTGRES_PASSWORD=mysecretpass
|
|||
POSTGRES_USER=postgresuser
|
||||
|
||||
# General settings
|
||||
# DJANGO_READ_DOT_ENV_FILE=True
|
||||
DJANGO_ADMIN_URL=
|
||||
DJANGO_SETTINGS_MODULE=config.settings.production
|
||||
DJANGO_SECRET_KEY=CHANGEME!!!
|
||||
|
|
|
@ -16,7 +16,7 @@ var gulp = require('gulp'),
|
|||
pixrem = require('gulp-pixrem'),
|
||||
uglify = require('gulp-uglify'),
|
||||
imagemin = require('gulp-imagemin'),
|
||||
exec = require('child_process').exec,
|
||||
spawn = require('child_process').spawn,
|
||||
runSequence = require('run-sequence'),
|
||||
browserSync = require('browser-sync').create(),
|
||||
reload = browserSync.reload;
|
||||
|
@ -48,7 +48,7 @@ gulp.task('styles', function() {
|
|||
return gulp.src(paths.sass + '/project.scss')
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(plumber()) // Checks for errors
|
||||
.pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes
|
||||
.pipe(autoprefixer({browsers: ['last 2 versions']})) // Adds vendor prefixes
|
||||
.pipe(pixrem()) // add fallbacks for rem units
|
||||
.pipe(gulp.dest(paths.css))
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
|
@ -73,10 +73,11 @@ gulp.task('imgCompression', function(){
|
|||
});
|
||||
|
||||
// Run django server
|
||||
gulp.task('runServer', function() {
|
||||
exec('python manage.py runserver', function (err, stdout, stderr) {
|
||||
console.log(stdout);
|
||||
console.log(stderr);
|
||||
gulp.task('runServer', function(cb) {
|
||||
var cmd = spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'});
|
||||
cmd.on('close', function(code) {
|
||||
console.log('runServer exited with code ' + code);
|
||||
cb(code);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -88,17 +89,8 @@ gulp.task('browserSync', function() {
|
|||
});
|
||||
});
|
||||
|
||||
// Default task
|
||||
gulp.task('default', function() {
|
||||
runSequence(['styles', 'scripts', 'imgCompression'], 'runServer', 'browserSync');
|
||||
});
|
||||
|
||||
////////////////////////////////
|
||||
//Watch//
|
||||
////////////////////////////////
|
||||
|
||||
// Watch
|
||||
gulp.task('watch', ['default'], function() {
|
||||
gulp.task('watch', function() {
|
||||
|
||||
gulp.watch(paths.sass + '/*.scss', ['styles']);
|
||||
gulp.watch(paths.js + '/*.js', ['scripts']).on("change", reload);
|
||||
|
@ -106,3 +98,8 @@ gulp.task('watch', ['default'], function() {
|
|||
gulp.watch(paths.templates + '/**/*.html').on("change", reload);
|
||||
|
||||
});
|
||||
|
||||
// Default task
|
||||
gulp.task('default', function() {
|
||||
runSequence(['styles', 'scripts', 'imgCompression'], 'runServer', 'browserSync', 'watch');
|
||||
});
|
||||
|
|
|
@ -20,4 +20,10 @@ if __name__ == '__main__':
|
|||
"forget to activate a virtual environment?"
|
||||
)
|
||||
raise
|
||||
|
||||
# This allows easy placement of apps within the interior
|
||||
# {{ cookiecutter.project_slug }} directory.
|
||||
current_path = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(os.path.join(current_path, '{{ cookiecutter.project_slug }}'))
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE=config.settings.local
|
||||
DJANGO_SETTINGS_MODULE=config.settings.test
|
||||
|
|
|
@ -1,60 +1,62 @@
|
|||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
# Wheel 0.25+ needed to install certain packages on CPython 3.5+
|
||||
# like Pillow and psycopg2
|
||||
# See http://bitly.com/wheel-building-fails-CPython-35
|
||||
# Verified bug on Python 3.5.1
|
||||
wheel==0.29.0
|
||||
{%- endif %}
|
||||
|
||||
|
||||
# Bleeding edge Django
|
||||
django==1.10.2
|
||||
django==1.10.7 # pyup: >=1.10,<1.11
|
||||
|
||||
# Configuration
|
||||
django-environ==0.4.0
|
||||
django-environ==0.4.3
|
||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||
whitenoise==3.2.2
|
||||
whitenoise==3.3.0
|
||||
{%- endif %}
|
||||
|
||||
|
||||
# Forms
|
||||
django-braces==1.9.0
|
||||
django-braces==1.11.0
|
||||
django-crispy-forms==1.6.1
|
||||
|
||||
# Models
|
||||
django-model-utils==2.6
|
||||
django-model-utils==3.0.0
|
||||
|
||||
# Images
|
||||
Pillow==3.4.1
|
||||
Pillow==4.1.1
|
||||
|
||||
# Password storage
|
||||
argon2-cffi==16.3.0
|
||||
|
||||
# For user registration, either via email or social
|
||||
# Well-built with regular release cycles!
|
||||
django-allauth==0.28.0
|
||||
django-allauth==0.32.0
|
||||
|
||||
{% if cookiecutter.windows == 'y' -%}
|
||||
# On Windows, you must download/install psycopg2 manually
|
||||
# from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg
|
||||
{% else %}
|
||||
# Python-PostgreSQL Database Adapter
|
||||
psycopg2==2.6.2
|
||||
psycopg2==2.7.1
|
||||
{%- endif %}
|
||||
|
||||
# Unicode slugification
|
||||
awesome-slugify==1.6.5
|
||||
|
||||
# Time zones support
|
||||
pytz==2016.7
|
||||
pytz==2017.2
|
||||
|
||||
# Redis support
|
||||
django-redis==4.5.0
|
||||
django-redis==4.8.0
|
||||
redis>=2.10.5
|
||||
|
||||
{% if cookiecutter.use_celery == "y" %}
|
||||
celery==3.1.24
|
||||
celery==3.1.25
|
||||
{% endif %}
|
||||
|
||||
{% if cookiecutter.use_compressor == "y" %}
|
||||
rcssmin==1.0.6 {% if cookiecutter.windows == 'y' %}--install-option="--without-c-extensions"{% endif %}
|
||||
django-compressor==2.1
|
||||
django-compressor==2.1.1
|
||||
{% endif %}
|
||||
|
||||
# Your custom requirements go here
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
# Local development dependencies go here
|
||||
-r base.txt
|
||||
coverage==4.2
|
||||
django-coverage-plugin==1.3.1
|
||||
Sphinx==1.4.8
|
||||
django-extensions==1.7.4
|
||||
Werkzeug==0.11.11
|
||||
django-test-plus==1.0.15
|
||||
factory_boy==2.7.0
|
||||
|
||||
django-debug-toolbar==1.6
|
||||
coverage==4.4.1
|
||||
django-coverage-plugin==1.5.0
|
||||
|
||||
Sphinx==1.6.2
|
||||
django-extensions==1.7.9
|
||||
Werkzeug==0.12.2
|
||||
django-test-plus==1.0.17
|
||||
factory-boy==2.8.1
|
||||
|
||||
django-debug-toolbar==1.8
|
||||
|
||||
# improved REPL
|
||||
ipdb==0.10.1
|
||||
ipdb==0.10.3
|
||||
|
||||
pytest-django==3.0.0
|
||||
pytest-sugar==0.7.1
|
||||
pytest-django==3.1.2
|
||||
pytest-sugar==0.8.0
|
||||
|
|
|
@ -6,34 +6,34 @@
|
|||
# Python-PostgreSQL Database Adapter
|
||||
# If using Win for dev, this assumes Unix in prod
|
||||
# ------------------------------------------------
|
||||
psycopg2==2.6.2
|
||||
psycopg2==2.7.1
|
||||
{%- endif %}
|
||||
|
||||
# WSGI Handler
|
||||
# ------------------------------------------------
|
||||
gevent==1.1.2
|
||||
gunicorn==19.6.0
|
||||
gevent==1.2.2
|
||||
gunicorn==19.7.1
|
||||
|
||||
# Static and Media Storage
|
||||
# ------------------------------------------------
|
||||
boto==2.42.0
|
||||
boto==2.47.0
|
||||
django-storages-redux==1.3.2
|
||||
{% if cookiecutter.use_whitenoise != 'y' -%}
|
||||
Collectfast==0.2.3
|
||||
Collectfast==0.5.2
|
||||
{%- endif %}
|
||||
|
||||
# Email backends for Mailgun, Postmark, SendGrid and more
|
||||
# -------------------------------------------------------
|
||||
django-anymail==0.5
|
||||
django-anymail==0.10
|
||||
|
||||
{% if cookiecutter.use_sentry_for_error_reporting == "y" -%}
|
||||
# Raven is the Sentry client
|
||||
# --------------------------
|
||||
raven==5.27.1
|
||||
raven==6.1.0
|
||||
{%- endif %}
|
||||
|
||||
{% if cookiecutter.use_opbeat == "y" -%}
|
||||
# Opbeat agent for performance monitoring
|
||||
# -----------------------------------------
|
||||
opbeat==3.4.0
|
||||
opbeat==3.5.2
|
||||
{%- endif %}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
{% if cookiecutter.windows == 'y' -%}
|
||||
# Python-PostgreSQL Database Adapter
|
||||
# If using Win for dev, this assumes Unix in test/prod
|
||||
psycopg2==2.6.2
|
||||
psycopg2==2.7.1
|
||||
{%- endif %}
|
||||
|
||||
coverage==4.2
|
||||
flake8==3.0.4 # pyup: != 2.6.0
|
||||
django-test-plus==1.0.15
|
||||
factory_boy==2.7.0
|
||||
coverage==4.4.1
|
||||
flake8==3.3.0 # pyup: != 2.6.0
|
||||
django-test-plus==1.0.17
|
||||
factory-boy==2.8.1
|
||||
|
||||
# pytest
|
||||
pytest-django==3.0.0
|
||||
pytest-sugar==0.7.1
|
||||
pytest-django==3.1.2
|
||||
pytest-sugar==0.8.0
|
||||
|
|
|
@ -1 +1 @@
|
|||
{% if cookiecutter.use_python3 == 'y' -%}python-3.5.1{% else %}python-2.7.10{%- endif %}
|
||||
python-3.5.3
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
max-line-length = 120
|
||||
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
|
||||
[pep8]
|
||||
[pycodestyle]
|
||||
max-line-length = 120
|
||||
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
|
|
|
@ -6,11 +6,7 @@ PROJECT_DIR="$(dirname "$WORK_DIR")"
|
|||
pip --version >/dev/null 2>&1 || {
|
||||
echo >&2 -e "\npip is required but it's not installed."
|
||||
echo >&2 -e "You can install it by running the following command:\n"
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python3 get-pip.py"
|
||||
{% else %}
|
||||
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python2 get-pip.py"
|
||||
{%- endif %}
|
||||
echo >&2 -e "\n"
|
||||
echo >&2 -e "\nFor more information, see pip documentation: https://pip.pypa.io/en/latest/"
|
||||
exit 1;
|
||||
|
@ -19,11 +15,7 @@ pip --version >/dev/null 2>&1 || {
|
|||
virtualenv --version >/dev/null 2>&1 || {
|
||||
echo >&2 -e "\nvirtualenv is required but it's not installed."
|
||||
echo >&2 -e "You can install it by running the following command:\n"
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
echo >&2 "sudo -H pip3 install virtualenv"
|
||||
{% else %}
|
||||
echo >&2 "sudo -H pip2 install virtualenv"
|
||||
{%- endif %}
|
||||
echo >&2 -e "\n"
|
||||
echo >&2 -e "\nFor more information, see virtualenv documentation: https://virtualenv.pypa.io/en/latest/"
|
||||
exit 1;
|
||||
|
@ -32,11 +24,7 @@ virtualenv --version >/dev/null 2>&1 || {
|
|||
if [ -z "$VIRTUAL_ENV" ]; then
|
||||
echo >&2 -e "\nYou need activate a virtualenv first"
|
||||
echo >&2 -e 'If you do not have a virtualenv created, run the following command to create and automatically activate a new virtualenv named "venv" on current folder:\n'
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
echo >&2 -e "virtualenv venv --python=\`which python3\`"
|
||||
{% else %}
|
||||
echo >&2 -e "virtualenv venv --python=\`which python2\`"
|
||||
{%- endif %}
|
||||
echo >&2 -e "\nTo leave/disable the currently active virtualenv, run the following command:\n"
|
||||
echo >&2 "deactivate"
|
||||
echo >&2 -e "\nTo activate the virtualenv again, run the following command:\n"
|
||||
|
@ -52,4 +40,3 @@ else
|
|||
pip install -r $PROJECT_DIR/requirements.txt
|
||||
{%- endif %}
|
||||
fi
|
||||
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
build-essential
|
||||
#required to translate
|
||||
gettext
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
python3-dev
|
||||
{% else %}
|
||||
python-dev
|
||||
{%- endif %}
|
||||
|
||||
##shared dependencies of:
|
||||
##Pillow, pylibmc
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
build-essential
|
||||
#required to translate
|
||||
gettext
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
python3-dev
|
||||
{% else %}
|
||||
python-dev
|
||||
{%- endif %}
|
||||
|
||||
##shared dependencies of:
|
||||
##Pillow, pylibmc
|
||||
|
@ -25,4 +21,3 @@ libwebp-dev
|
|||
|
||||
##django-extensions
|
||||
graphviz-dev
|
||||
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
build-essential
|
||||
#required to translate
|
||||
gettext
|
||||
{% if cookiecutter.use_python3 == 'y' -%}
|
||||
python3-dev
|
||||
{% else %}
|
||||
python-dev
|
||||
{%- endif %}
|
||||
|
||||
##shared dependencies of:
|
||||
##Pillow, pylibmc
|
||||
|
@ -25,4 +21,3 @@ libwebp-dev
|
|||
|
||||
##django-extensions
|
||||
graphviz-dev
|
||||
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
__version__ = '{{ cookiecutter.version }}'
|
||||
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])
|
||||
|
|
|
@ -3,4 +3,3 @@ To understand why this file is here, please read:
|
|||
|
||||
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||
"""
|
||||
# -*- coding: utf-8 -*-
|
||||
|
|
|
@ -3,4 +3,3 @@ To understand why this file is here, please read:
|
|||
|
||||
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||
"""
|
||||
# -*- coding: utf-8 -*-
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.sites.models
|
||||
from django.contrib.sites.models import _simple_domain_name_validator
|
||||
from django.db import migrations, models
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.sites.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
@ -3,10 +3,6 @@ To understand why this file is here, please read:
|
|||
|
||||
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||
"""
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@ To understand why this file is here, please read:
|
|||
|
||||
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||
"""
|
||||
# -*- coding: utf-8 -*-
|
||||
|
|
|
@ -1,3 +1,57 @@
|
|||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
||||
@import "variables";
|
||||
@import "custom_bootstrap_vars";
|
||||
@import "mixins";
|
||||
|
||||
// Reset and dependencies
|
||||
@import "normalize";
|
||||
@import "print";
|
||||
@import "glyphicons";
|
||||
|
||||
// Core CSS
|
||||
@import "scaffolding";
|
||||
@import "type";
|
||||
@import "code";
|
||||
@import "grid";
|
||||
@import "tables";
|
||||
@import "forms";
|
||||
@import "buttons";
|
||||
|
||||
// Components
|
||||
@import "component-animations";
|
||||
@import "dropdowns";
|
||||
@import "button-groups";
|
||||
@import "input-groups";
|
||||
@import "navs";
|
||||
@import "navbar";
|
||||
@import "breadcrumbs";
|
||||
@import "pagination";
|
||||
@import "pager";
|
||||
@import "labels";
|
||||
@import "badges";
|
||||
@import "jumbotron";
|
||||
@import "thumbnails";
|
||||
@import "alerts";
|
||||
@import "progress-bars";
|
||||
@import "media";
|
||||
@import "list-group";
|
||||
@import "panels";
|
||||
@import "responsive-embed";
|
||||
@import "wells";
|
||||
@import "close";
|
||||
|
||||
// Components w/ JavaScript
|
||||
@import "modals";
|
||||
@import "tooltip";
|
||||
@import "popovers";
|
||||
@import "carousel";
|
||||
|
||||
// Utility classes
|
||||
@import "utilities";
|
||||
@import "responsive-utilities";
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
// project specific CSS goes here
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% if cookiecutter.use_celery == 'y' %}
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
from celery import Celery
|
||||
from django.apps import apps, AppConfig
|
||||
|
@ -28,9 +27,19 @@ class CeleryConfig(AppConfig):
|
|||
{% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
|
||||
if hasattr(settings, 'RAVEN_CONFIG'):
|
||||
# Celery signal registration
|
||||
{% if cookiecutter.use_pycharm == 'y' -%}
|
||||
# Since raven is required in production only,
|
||||
# imports might (most surely will) be wiped out
|
||||
# during PyCharm code clean up started
|
||||
# in other environments.
|
||||
# @formatter:off
|
||||
{%- endif %}
|
||||
from raven import Client as RavenClient
|
||||
from raven.contrib.celery import register_signal as raven_register_signal
|
||||
from raven.contrib.celery import register_logger_signal as raven_register_logger_signal
|
||||
{% if cookiecutter.use_pycharm == 'y' -%}
|
||||
# @formatter:on
|
||||
{%- endif %}
|
||||
|
||||
raven_client = RavenClient(dsn=settings.RAVEN_CONFIG['DSN'])
|
||||
raven_register_logger_signal(raven_client)
|
||||
|
@ -39,10 +48,20 @@ class CeleryConfig(AppConfig):
|
|||
|
||||
{% if cookiecutter.use_opbeat == 'y' -%}
|
||||
if hasattr(settings, 'OPBEAT'):
|
||||
{% if cookiecutter.use_pycharm == 'y' -%}
|
||||
# Since opbeat is required in production only,
|
||||
# imports might (most surely will) be wiped out
|
||||
# during PyCharm code clean up started
|
||||
# in other environments.
|
||||
# @formatter:off
|
||||
{%- endif %}
|
||||
from opbeat.contrib.django.models import client as opbeat_client
|
||||
from opbeat.contrib.django.models import logger as opbeat_logger
|
||||
from opbeat.contrib.django.models import register_handlers as opbeat_register_handlers
|
||||
from opbeat.contrib.celery import register_signal as opbeat_register_signal
|
||||
{% if cookiecutter.use_pycharm == 'y' -%}
|
||||
# @formatter:on
|
||||
{%- endif %}
|
||||
|
||||
try:
|
||||
opbeat_register_signal(opbeat_client)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% raw %}{% extends "base.html" %}
|
||||
|
||||
{% block title %}Page Not found{% endblock %}
|
||||
{% block title %}Page not found{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Page Not found</h1>
|
||||
<h1>Page not found</h1>
|
||||
|
||||
<p>This is not the page you were looking for.</p>
|
||||
{% endblock content %}{% endraw %}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<input type="submit" value="{% trans 'Reset My Password' %}" />
|
||||
<input class="btn btn-primary" type="submit" value="{% trans 'Reset My Password' %}" />
|
||||
</form>
|
||||
|
||||
<p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
{% block css %}
|
||||
<!-- Latest compiled and minified Bootstrap 4 Alpha 4 CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="sha384-2hfp1SzUoho7/TsGGGDaFdsuuDL0LX2hnUp6VkX3CUQ2K4K+xjboZdsXyp4oUHZj" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
|
||||
|
||||
<!-- Your stuff: Third-party CSS libraries go here -->
|
||||
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress css %}{% endraw %}{% endif %}{% raw %}
|
||||
|
@ -29,44 +29,43 @@
|
|||
<body>
|
||||
|
||||
<div class="m-b-1">
|
||||
<nav class="navbar navbar-dark navbar-static-top bg-inverse">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
|
||||
<button type="button" class="navbar-toggler hidden-sm-up pull-xs-right" data-toggle="collapse" data-target="#bs-navbar-collapse-1">
|
||||
☰
|
||||
</button>
|
||||
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
|
||||
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{% url 'home' %}">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-toggleable-xs" id="bs-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="{% url 'home' %}">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'about' %}">About</a>
|
||||
</li>
|
||||
{% if request.user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'home' %}">Home</a>
|
||||
{# URL provided by django-allauth/account/urls.py #}
|
||||
<a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'about' %}">About</a>
|
||||
{# URL provided by django-allauth/account/urls.py #}
|
||||
<a class="nav-link" href="{% url 'account_logout' %}">{% trans "Sign Out" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav pull-xs-right">
|
||||
{% if request.user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'account_logout' %}">{% trans "Sign Out" %}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
{# URL provided by django-allauth/account/urls.py #}
|
||||
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
{# URL provided by django-allauth/account/urls.py #}
|
||||
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
@ -90,9 +89,9 @@
|
|||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
{% block javascript %}
|
||||
<!-- Required by Bootstrap v4 Alpha 4 -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js" integrity="sha384-VjEeINv9OSwtWFLAtmc4JCtEJXXBub00gtSnszmspDLCtC0I4z4nqz7rEFbIZLLU" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Your stuff: Third-party javascript libraries go here -->
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.conf import settings
|
||||
from allauth.account.adapter import DefaultAccountAdapter
|
||||
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.1 on 2016-09-23 04:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.auth.models
|
||||
import django.contrib.auth.validators
|
||||
from django.db import migrations, models
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user