Merge branch 'master' into gulpfile-js

This commit is contained in:
Nikita P. Shupeyko 2017-05-02 14:18:37 +03:00
commit 5abe1437fa
10 changed files with 64 additions and 24 deletions

View File

@ -29,7 +29,7 @@ Features
---------
* 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
* Twitter Bootstrap_ v4.0.0 - alpha 6 (`maintained Foundation fork`_ also available)
* 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:
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
:name: Two Scoops Press
.. 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 Press
:target: https://twoscoopspress.com
:alt: Two Scoops of Django
: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
~~~~~~~~~~~~~~~~~~

View File

@ -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
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
----------------------
@ -102,7 +109,7 @@ 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 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)::

View File

@ -201,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']
@ -283,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()

View File

@ -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 == ''])))

View File

@ -8,9 +8,6 @@ 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
RUN sed -i 's/\r//' /entrypoint.sh \
@ -20,6 +17,11 @@ 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"]

View File

@ -268,11 +268,11 @@ AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
{% if cookiecutter.use_celery == 'y' %}
########## CELERY
INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
BROKER_URL = env('CELERY_BROKER_URL', default='django://')
if BROKER_URL == 'django://':
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 %}

View File

@ -16,7 +16,6 @@ services:
build:
context: .
dockerfile: ./compose/django/Dockerfile
user: django
depends_on:
- postgres
- redis
@ -63,7 +62,6 @@ services:
build:
context: .
dockerfile: ./compose/django/Dockerfile
user: django
env_file: .env
depends_on:
- postgres
@ -74,7 +72,6 @@ services:
build:
context: .
dockerfile: ./compose/django/Dockerfile
user: django
env_file: .env
depends_on:
- postgres

View File

@ -23,14 +23,14 @@ django-crispy-forms==1.6.1
django-model-utils==3.0.0
# Images
Pillow==4.1.0
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.31.0
django-allauth==0.32.0
{% if cookiecutter.windows == 'y' -%}
# On Windows, you must download/install psycopg2 manually
@ -47,11 +47,11 @@ awesome-slugify==1.6.5
pytz==2017.2
# Redis support
django-redis==4.7.0
django-redis==4.8.0
redis>=2.10.5
{% if cookiecutter.use_celery == "y" %}
celery==4.0.2
celery==3.1.24
{% endif %}
{% if cookiecutter.use_compressor == "y" %}

View File

@ -13,7 +13,7 @@ factory-boy==2.8.1
django-debug-toolbar==1.7
# improved REPL
ipdb==0.10.2
ipdb==0.10.3
pytest-django==3.1.2
pytest-sugar==0.8.0

View File

@ -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