mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-16 19:12:25 +03:00
Merge branch 'master' into gulpfile-js
This commit is contained in:
commit
5abe1437fa
16
README.rst
16
README.rst
|
@ -29,7 +29,7 @@ Features
|
||||||
---------
|
---------
|
||||||
|
|
||||||
* For Django 1.10
|
* For Django 1.10
|
||||||
* Works with Python 3.4.x or 3.5.x. Python 3.6 is experimenta
|
* Works with Python 3.4.x or 3.5.x. Python 3.6 is experimental
|
||||||
* Renders Django projects with 100% starting test coverage
|
* Renders Django projects with 100% starting test coverage
|
||||||
* Twitter Bootstrap_ v4.0.0 - alpha 6 (`maintained Foundation fork`_ also available)
|
* Twitter Bootstrap_ v4.0.0 - alpha 6 (`maintained Foundation fork`_ also available)
|
||||||
* 12-Factor_ based settings via django-environ_
|
* 12-Factor_ based settings via django-environ_
|
||||||
|
@ -263,16 +263,16 @@ Support This Project
|
||||||
|
|
||||||
This project is maintained by volunteers. Support their efforts by spreading the word about:
|
This project is maintained by volunteers. Support their efforts by spreading the word about:
|
||||||
|
|
||||||
Two Scoops Press
|
Two Scoops of Django 1.11
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. image:: https://cdn.shopify.com/s/files/1/0304/6901/t/2/assets/logo.png?11985289740589874793
|
.. image:: https://cdn.shopify.com/s/files/1/0304/6901/files/tsd-111-alpha-470x235.jpg?2934688328290951771
|
||||||
:name: Two Scoops Press
|
:name: Two Scoops of Django 1.11 Cover
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Two Scoops Press
|
:alt: Two Scoops of Django
|
||||||
:target: https://twoscoopspress.com
|
:target: http://twoscoopspress.org/products/two-scoops-of-django-1-11
|
||||||
|
|
||||||
Two Scoops Press brings you the best dairy-themed Django references in the universe
|
Two Scoops of Django is the best dairy-themed Django reference in the universe
|
||||||
|
|
||||||
pyup
|
pyup
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -37,6 +37,13 @@ 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
|
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.
|
you are relying solely on git.
|
||||||
|
|
||||||
|
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
|
HTTPS is on by default
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
@ -102,7 +109,7 @@ If you would like to set up autorenewal of your certificates, the following comm
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd <project directory>
|
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-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 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)::
|
And then set a cronjob by running `crontab -e` and placing in it (period can be adjusted as desired)::
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,16 @@ def remove_elasticbeanstalk():
|
||||||
PROJECT_DIRECTORY, filename
|
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
|
# IN PROGRESS
|
||||||
# def copy_doc_files(project_directory):
|
# def copy_doc_files(project_directory):
|
||||||
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
|
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
|
||||||
|
@ -283,3 +293,7 @@ if '{{ cookiecutter.open_source_license}}' != 'GPLv3':
|
||||||
# 12. Remove Elastic Beanstalk files
|
# 12. Remove Elastic Beanstalk files
|
||||||
if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
|
if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
|
||||||
remove_elasticbeanstalk()
|
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'):
|
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.")
|
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 == ''])))
|
||||||
|
|
|
@ -8,9 +8,6 @@ RUN pip install -r /requirements/production.txt \
|
||||||
&& groupadd -r django \
|
&& groupadd -r django \
|
||||||
&& useradd -r -g django django
|
&& useradd -r -g django django
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
RUN chown -R django /app
|
|
||||||
|
|
||||||
COPY ./compose/django/gunicorn.sh /gunicorn.sh
|
COPY ./compose/django/gunicorn.sh /gunicorn.sh
|
||||||
COPY ./compose/django/entrypoint.sh /entrypoint.sh
|
COPY ./compose/django/entrypoint.sh /entrypoint.sh
|
||||||
RUN sed -i 's/\r//' /entrypoint.sh \
|
RUN sed -i 's/\r//' /entrypoint.sh \
|
||||||
|
@ -20,6 +17,11 @@ RUN sed -i 's/\r//' /entrypoint.sh \
|
||||||
&& chmod +x /gunicorn.sh \
|
&& chmod +x /gunicorn.sh \
|
||||||
&& chown django /gunicorn.sh
|
&& chown django /gunicorn.sh
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
RUN chown -R django /app
|
||||||
|
USER django
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -268,11 +268,11 @@ AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
|
||||||
{% if cookiecutter.use_celery == 'y' %}
|
{% if cookiecutter.use_celery == 'y' %}
|
||||||
########## CELERY
|
########## CELERY
|
||||||
INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
|
INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
|
||||||
BROKER_URL = env('CELERY_BROKER_URL', default='django://')
|
CELERY_BROKER_URL = env('CELERY_BROKER_URL', default='django://')
|
||||||
if BROKER_URL == 'django://':
|
if CELERY_BROKER_URL == 'django://':
|
||||||
CELERY_RESULT_BACKEND = 'redis://'
|
CELERY_RESULT_BACKEND = 'redis://'
|
||||||
else:
|
else:
|
||||||
CELERY_RESULT_BACKEND = BROKER_URL
|
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
||||||
########## END CELERY
|
########## END CELERY
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/django/Dockerfile
|
dockerfile: ./compose/django/Dockerfile
|
||||||
user: django
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
|
@ -63,7 +62,6 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/django/Dockerfile
|
dockerfile: ./compose/django/Dockerfile
|
||||||
user: django
|
|
||||||
env_file: .env
|
env_file: .env
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
@ -74,7 +72,6 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/django/Dockerfile
|
dockerfile: ./compose/django/Dockerfile
|
||||||
user: django
|
|
||||||
env_file: .env
|
env_file: .env
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
|
|
@ -23,14 +23,14 @@ django-crispy-forms==1.6.1
|
||||||
django-model-utils==3.0.0
|
django-model-utils==3.0.0
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
Pillow==4.1.0
|
Pillow==4.1.1
|
||||||
|
|
||||||
# Password storage
|
# Password storage
|
||||||
argon2-cffi==16.3.0
|
argon2-cffi==16.3.0
|
||||||
|
|
||||||
# For user registration, either via email or social
|
# For user registration, either via email or social
|
||||||
# Well-built with regular release cycles!
|
# Well-built with regular release cycles!
|
||||||
django-allauth==0.31.0
|
django-allauth==0.32.0
|
||||||
|
|
||||||
{% if cookiecutter.windows == 'y' -%}
|
{% if cookiecutter.windows == 'y' -%}
|
||||||
# On Windows, you must download/install psycopg2 manually
|
# On Windows, you must download/install psycopg2 manually
|
||||||
|
@ -47,11 +47,11 @@ awesome-slugify==1.6.5
|
||||||
pytz==2017.2
|
pytz==2017.2
|
||||||
|
|
||||||
# Redis support
|
# Redis support
|
||||||
django-redis==4.7.0
|
django-redis==4.8.0
|
||||||
redis>=2.10.5
|
redis>=2.10.5
|
||||||
|
|
||||||
{% if cookiecutter.use_celery == "y" %}
|
{% if cookiecutter.use_celery == "y" %}
|
||||||
celery==4.0.2
|
celery==3.1.24
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if cookiecutter.use_compressor == "y" %}
|
{% if cookiecutter.use_compressor == "y" %}
|
||||||
|
|
|
@ -13,7 +13,7 @@ factory-boy==2.8.1
|
||||||
django-debug-toolbar==1.7
|
django-debug-toolbar==1.7
|
||||||
|
|
||||||
# improved REPL
|
# improved REPL
|
||||||
ipdb==0.10.2
|
ipdb==0.10.3
|
||||||
|
|
||||||
pytest-django==3.1.2
|
pytest-django==3.1.2
|
||||||
pytest-sugar==0.8.0
|
pytest-sugar==0.8.0
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||||
|
|
||||||
[pep8]
|
[pycodestyle]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||||
|
|
Loading…
Reference in New Issue
Block a user