diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b55e1f8..b5348300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,39 @@ All enhancements and patches to cookiecutter-django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2015-10-28] +### Changed +- Update deployment-on-heroku.rst for ADMIN_URL (@yunti) + +## [2015-10-27] +### Added +- Added sudo: true to the travis file (@MathijsHoogland) + +## [2015-10-25] +### Added +- Move current logging config into production.py since it's not useful locally anyway. Used only if not using Sentry. (@audreyr) +- `setup.py` so we can list it on PyPI and therefore displayed on djangopackages.com as compatible with Python 3. (@pydanny) +- Versioning and tagging policy (@pydanny) +- Fixed flake8 issue (@pydanny) + +## [2015-10-24] +### Changed +- Update nav in base template to latest Bootstrap 4 version (@audreyr) +- Replaced ADD with COPY in dockerfiles (@audreyr) +- Simplified development dockerfile (@jayfk) +- Moved the docker postgres volume on the development environment to it's own subfolder (@jayfk) +- Renamed DJANGO_CACHE_URL to REDIS_URL (@jayfk / proposed by @pydanny) + +## [2015-10-22] +### Removed +- Remove unnecessary .gitkeep in static/images/ (@audreyr) + +## [2015-10-21] +### Changed +- Updated requirements (@theskumar) +### Removed +- editorconfig comment that was just a isort settings link (@pydanny) + ## [2015-10-19] ### Changed - On Windows, don't install psycopg2 locally. Still install it in test/prod which are assumed to be Unix. (@audreyr) diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index ef6dee59..d0d5abc9 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -29,6 +29,7 @@ You can either push the 'deploy' button in your generated README.rst or run thes heroku config:set DJANGO_MAILGUN_API_KEY=YOUR_MAILGUN_API_KEY heroku config:set PYTHONHASHSEED=random + heroku config:set DJANGO_ADMIN_URL=\^somelocation/ git push heroku master heroku run python manage.py migrate diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..31edec6c --- /dev/null +++ b/setup.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import os +import platform +import sys + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +# 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.8.5" + +if sys.argv[-1] == 'tag': + os.system("git tag -a %s -m 'version %s'" % (version, version)) + os.system("git push --tags") + sys.exit() + +with open('README.rst') as readme_file: + long_description = readme_file.read() + +setup( + name='cookiecutter-django', + version=version, + description='A Cookiecutter template for creating production-ready Django projects quickly.', + long_description=long_description, + author='Daniel Roy Greenfeld', + author_email='pydanny@gmail.com', + url='https://github.com/pydanny/cookiecutter-django', + packages=[], + license='BSD', + zip_safe=False, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'Framework :: Django :: 1.8', + 'Intended Audience :: Developers', + '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', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development', + ], + keywords=( + 'cookiecutter, Python, projects, project templates, django, ' + 'skeleton, scaffolding, project directory, setup.py' + ), +) diff --git a/{{cookiecutter.repo_name}}/.editorconfig b/{{cookiecutter.repo_name}}/.editorconfig index e7aa555a..78c90f9c 100644 --- a/{{cookiecutter.repo_name}}/.editorconfig +++ b/{{cookiecutter.repo_name}}/.editorconfig @@ -13,7 +13,6 @@ indent_style = space indent_size = 4 [*.py] -# https://github.com/timothycrosley/isort/wiki/isort-Settings line_length=120 known_first_party={{ cookiecutter.repo_name }} multi_line_output=3 diff --git a/{{cookiecutter.repo_name}}/.travis.yml b/{{cookiecutter.repo_name}}/.travis.yml index f7e40a1e..f5b02a01 100644 --- a/{{cookiecutter.repo_name}}/.travis.yml +++ b/{{cookiecutter.repo_name}}/.travis.yml @@ -1,3 +1,4 @@ +sudo: true before_install: - sudo apt-get update -qq - sudo apt-get install -qq build-essential gettext python-dev zlib1g-dev libpq-dev xvfb diff --git a/{{cookiecutter.repo_name}}/Dockerfile b/{{cookiecutter.repo_name}}/Dockerfile index 2a038555..08d43f61 100644 --- a/{{cookiecutter.repo_name}}/Dockerfile +++ b/{{cookiecutter.repo_name}}/Dockerfile @@ -6,16 +6,16 @@ FROM python:2.7 ENV PYTHONUNBUFFERED 1 # Requirements have to be pulled and installed here, otherwise caching won't work -ADD ./requirements /requirements +COPY ./requirements /requirements RUN pip install -r /requirements/production.txt RUN groupadd -r django && useradd -r -g django django -ADD . /app +COPY . /app RUN chown -R django /app -ADD ./compose/django/gunicorn.sh /gunicorn.sh -ADD ./compose/django/entrypoint.sh /entrypoint.sh +COPY ./compose/django/gunicorn.sh /gunicorn.sh +COPY ./compose/django/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh && chown django /entrypoint.sh RUN chmod +x /gunicorn.sh && chown django /gunicorn.sh diff --git a/{{cookiecutter.repo_name}}/Dockerfile-dev b/{{cookiecutter.repo_name}}/Dockerfile-dev index f382b913..f07fe36a 100644 --- a/{{cookiecutter.repo_name}}/Dockerfile-dev +++ b/{{cookiecutter.repo_name}}/Dockerfile-dev @@ -6,19 +6,11 @@ FROM python:2.7 ENV PYTHONUNBUFFERED 1 # Requirements have to be pulled and installed here, otherwise caching won't work -ADD ./requirements /requirements - +COPY ./requirements /requirements RUN pip install -r /requirements/local.txt -RUN groupadd -r django && useradd -r -g django django -ADD . /app -RUN chown -R django /app - -ADD ./compose/django/gunicorn.sh /gunicorn.sh -ADD ./compose/django/entrypoint.sh /entrypoint.sh - -RUN chmod +x /entrypoint.sh && chown django /entrypoint.sh -RUN chmod +x /gunicorn.sh && chown django /gunicorn.sh +COPY ./compose/django/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh WORKDIR /app diff --git a/{{cookiecutter.repo_name}}/compose/django/entrypoint.sh b/{{cookiecutter.repo_name}}/compose/django/entrypoint.sh index 8c07a641..ffae9009 100644 --- a/{{cookiecutter.repo_name}}/compose/django/entrypoint.sh +++ b/{{cookiecutter.repo_name}}/compose/django/entrypoint.sh @@ -4,7 +4,7 @@ set -e # Since docker-compose relies heavily on environment variables itself for configuration, we'd have to define multiple # environment variables just to support cookiecutter out of the box. That makes no sense, so this little entrypoint # does all this for us. -export DJANGO_CACHE_URL=redis://redis:6379/0 +export REDIS_URL=redis://redis:6379/0 # the official postgres image uses 'postgres' as default user if not set explictly. if [ -z "$POSTGRES_ENV_POSTGRES_USER" ]; then @@ -13,6 +13,6 @@ fi export DATABASE_URL=postgres://$POSTGRES_ENV_POSTGRES_USER:$POSTGRES_ENV_POSTGRES_PASSWORD@postgres:5432/$POSTGRES_ENV_POSTGRES_USER {% if cookiecutter.use_celery == 'y' %} -export CELERY_BROKER_URL=$DJANGO_CACHE_URL +export CELERY_BROKER_URL=$REDIS_URL {% endif %} exec "$@" \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/config/settings/common.py b/{{cookiecutter.repo_name}}/config/settings/common.py index 836f099e..a0ab6063 100644 --- a/{{cookiecutter.repo_name}}/config/settings/common.py +++ b/{{cookiecutter.repo_name}}/config/settings/common.py @@ -220,55 +220,6 @@ LOGIN_URL = 'account_login' # SLUGLIFIER AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify' - - -# LOGGING CONFIGURATION -# ------------------------------------------------------------------------------ -# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging -# 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 -# more details on how to customize your logging configuration. -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'formatters': { - 'verbose': { - 'format': '%(levelname)s %(asctime)s %(module)s ' - '%(process)d %(thread)d %(message)s' - }, - }, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - }, - 'console': { - 'level': 'DEBUG', - 'class': 'logging.StreamHandler', - 'formatter': 'verbose', - }, - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True - }, - 'django.security.DisallowedHost': { - 'level': 'ERROR', - 'handlers': ['console', 'mail_admins'], - 'propagate': True - } - } -} {% if cookiecutter.use_celery == "y" %} ########## CELERY INSTALLED_APPS += ('{{cookiecutter.repo_name}}.taskapp.celery.CeleryConfig',) diff --git a/{{cookiecutter.repo_name}}/config/settings/production.py b/{{cookiecutter.repo_name}}/config/settings/production.py index e21bc59b..2a14ae9d 100644 --- a/{{cookiecutter.repo_name}}/config/settings/production.py +++ b/{{cookiecutter.repo_name}}/config/settings/production.py @@ -216,6 +216,54 @@ RAVEN_CONFIG = { 'CELERY_LOGLEVEL': env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO), 'DSN': SENTRY_DSN } +{% elif cookiecutter.use_sentry == "n" %} +# LOGGING CONFIGURATION +# ------------------------------------------------------------------------------ +# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging +# 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 +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s ' + '%(process)d %(thread)d %(message)s' + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True + }, + 'django.security.DisallowedHost': { + 'level': 'ERROR', + 'handlers': ['console', 'mail_admins'], + 'propagate': True + } + } +} {% endif %} # Custom Admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} ADMIN_URL = env('DJANGO_ADMIN_URL') diff --git a/{{cookiecutter.repo_name}}/dev.yml b/{{cookiecutter.repo_name}}/dev.yml index ffb40a0c..d50959d2 100644 --- a/{{cookiecutter.repo_name}}/dev.yml +++ b/{{cookiecutter.repo_name}}/dev.yml @@ -3,7 +3,7 @@ postgres: volumes: # If you are using boot2docker, postgres data has to live in the VM for now until #581 is fixed # for more info see here: https://github.com/boot2docker/boot2docker/issues/581 - - /data/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data + - /data/dev/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data django: dockerfile: Dockerfile-dev diff --git a/{{cookiecutter.repo_name}}/requirements/base.txt b/{{cookiecutter.repo_name}}/requirements/base.txt index c94ee52d..1ebdac4b 100644 --- a/{{cookiecutter.repo_name}}/requirements/base.txt +++ b/{{cookiecutter.repo_name}}/requirements/base.txt @@ -34,7 +34,7 @@ psycopg2==2.6.1 # Unicode slugification unicode-slugify==0.1.3 -django-autoslug==1.9.2 +django-autoslug==1.9.3 # Time zones support pytz==2015.6 diff --git a/{{cookiecutter.repo_name}}/requirements/local.txt b/{{cookiecutter.repo_name}}/requirements/local.txt index 3906fc91..ea6663f8 100644 --- a/{{cookiecutter.repo_name}}/requirements/local.txt +++ b/{{cookiecutter.repo_name}}/requirements/local.txt @@ -1,11 +1,11 @@ # Local development dependencies go here -r base.txt -coverage==4.0 +coverage==4.0.1 Sphinx django-extensions==1.5.7 Werkzeug==0.10.4 django-test-plus==1.0.9 -factory_boy==2.5.2 +factory_boy==2.6.0 # django-debug-toolbar that works with Django 1.5+ django-debug-toolbar==1.4 diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/static/images/.gitkeep b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/static/images/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html index 147daa32..8a09cb85 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html @@ -30,31 +30,43 @@ - +