From 906299ae39ee7f38e89bde6099297bc885dcf6cc Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 9 May 2018 12:49:39 +0300 Subject: [PATCH 01/65] Refactor POSTGRES_HOST env --- docs/developing-locally-docker.rst | 1 + {{cookiecutter.project_slug}}/.envs/.local/.postgres | 1 + {{cookiecutter.project_slug}}/.envs/.production/.postgres | 1 + .../compose/production/django/entrypoint.sh | 4 ++-- .../compose/production/postgres/maintenance/backup | 2 +- .../compose/production/postgres/maintenance/restore | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst index 86808bfd..207f0ea2 100644 --- a/docs/developing-locally-docker.rst +++ b/docs/developing-locally-docker.rst @@ -115,6 +115,7 @@ Consider the aforementioned ``.envs/.local/.postgres``: :: # PostgreSQL # ------------------------------------------------------------------------------ + POSTGRES_HOST=postgres POSTGRES_DB= POSTGRES_USER=XgOWtQtJecsAbaIyslwGvFvPawftNaqO POSTGRES_PASSWORD=jSljDz4whHuwO3aJIgVBrqEml5Ycbghorep4uVJ4xjDYQu0LfuTZdctj7y0YcCLu diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.postgres b/{{cookiecutter.project_slug}}/.envs/.local/.postgres index 87203da0..5b115017 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.postgres +++ b/{{cookiecutter.project_slug}}/.envs/.local/.postgres @@ -1,5 +1,6 @@ # PostgreSQL # ------------------------------------------------------------------------------ +POSTGRES_HOST=postgres POSTGRES_DB={{ cookiecutter.project_slug }} POSTGRES_USER=!!!SET POSTGRES_USER!!! POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.postgres b/{{cookiecutter.project_slug}}/.envs/.production/.postgres index 87203da0..5b115017 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.postgres +++ b/{{cookiecutter.project_slug}}/.envs/.production/.postgres @@ -1,5 +1,6 @@ # PostgreSQL # ------------------------------------------------------------------------------ +POSTGRES_HOST=postgres POSTGRES_DB={{ cookiecutter.project_slug }} POSTGRES_USER=!!!SET POSTGRES_USER!!! POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh index 0e0121c2..a995867f 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh @@ -14,7 +14,7 @@ if [ -z "${POSTGRES_USER}" ]; then base_postgres_image_default_user='postgres' export POSTGRES_USER="${base_postgres_image_default_user}" fi -export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}" +export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}" postgres_ready() { python << END @@ -27,7 +27,7 @@ try: dbname="${POSTGRES_DB}", user="${POSTGRES_USER}", password="${POSTGRES_PASSWORD}", - host="postgres" + host="${POSTGRES_HOST}" ) except psycopg2.OperationalError: sys.exit(-1) diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup index 10674f9f..31c59b2b 100644 --- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup +++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup @@ -25,7 +25,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then exit 1 fi -export PGHOST="postgres" +export PGHOST="${POSTGRES_HOST}" export PGUSER="${POSTGRES_USER}" export PGPASSWORD="${POSTGRES_PASSWORD}" export PGDATABASE="${POSTGRES_DB}" diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore index b2e0a18d..3d4f46c8 100644 --- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore +++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore @@ -37,7 +37,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then exit 1 fi -export PGHOST="postgres" +export PGHOST="${POSTGRES_HOST}" export PGUSER="${POSTGRES_USER}" export PGPASSWORD="${POSTGRES_PASSWORD}" export PGDATABASE="${POSTGRES_DB}" From 17739ff2630f0ead43065065f6b850d9ef2d5a9b Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 9 May 2018 12:58:37 +0300 Subject: [PATCH 02/65] Refactor POSTGRES_PORT env --- {{cookiecutter.project_slug}}/.envs/.local/.postgres | 1 + {{cookiecutter.project_slug}}/.envs/.production/.postgres | 1 + .../compose/production/django/entrypoint.sh | 5 +++-- .../compose/production/postgres/maintenance/backup | 1 + .../compose/production/postgres/maintenance/restore | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.postgres b/{{cookiecutter.project_slug}}/.envs/.local/.postgres index 5b115017..f190db8e 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.postgres +++ b/{{cookiecutter.project_slug}}/.envs/.local/.postgres @@ -1,6 +1,7 @@ # PostgreSQL # ------------------------------------------------------------------------------ POSTGRES_HOST=postgres +POSTGRES_PORT=5432 POSTGRES_DB={{ cookiecutter.project_slug }} POSTGRES_USER=!!!SET POSTGRES_USER!!! POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.postgres b/{{cookiecutter.project_slug}}/.envs/.production/.postgres index 5b115017..f190db8e 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.postgres +++ b/{{cookiecutter.project_slug}}/.envs/.production/.postgres @@ -1,6 +1,7 @@ # PostgreSQL # ------------------------------------------------------------------------------ POSTGRES_HOST=postgres +POSTGRES_PORT=5432 POSTGRES_DB={{ cookiecutter.project_slug }} POSTGRES_USER=!!!SET POSTGRES_USER!!! POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh index a995867f..74242bde 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh @@ -14,7 +14,7 @@ if [ -z "${POSTGRES_USER}" ]; then base_postgres_image_default_user='postgres' export POSTGRES_USER="${base_postgres_image_default_user}" fi -export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}" +export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" postgres_ready() { python << END @@ -27,7 +27,8 @@ try: dbname="${POSTGRES_DB}", user="${POSTGRES_USER}", password="${POSTGRES_PASSWORD}", - host="${POSTGRES_HOST}" + host="${POSTGRES_HOST}", + port="${POSTGRES_PORT}", ) except psycopg2.OperationalError: sys.exit(-1) diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup index 31c59b2b..ee0c9d63 100644 --- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup +++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup @@ -26,6 +26,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then fi export PGHOST="${POSTGRES_HOST}" +export PGPORT="${POSTGRES_PORT}" export PGUSER="${POSTGRES_USER}" export PGPASSWORD="${POSTGRES_PASSWORD}" export PGDATABASE="${POSTGRES_DB}" diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore index 3d4f46c8..9661ca7f 100644 --- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore +++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore @@ -38,6 +38,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then fi export PGHOST="${POSTGRES_HOST}" +export PGPORT="${POSTGRES_PORT}" export PGUSER="${POSTGRES_USER}" export PGPASSWORD="${POSTGRES_PASSWORD}" export PGDATABASE="${POSTGRES_DB}" From df1ce737d5d8744241e6d1d804a3e3b7b9379d76 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 9 May 2018 13:15:35 +0300 Subject: [PATCH 03/65] Replace os.environ.get with env call in local.py --- {{cookiecutter.project_slug}}/config/settings/local.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index 62dff552..d4f5a27a 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -62,9 +62,8 @@ DEBUG_TOOLBAR_CONFIG = { # https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#internal-ips INTERNAL_IPS = ['127.0.0.1', '10.0.2.2'] {% if cookiecutter.use_docker == 'y' -%} -import socket -import os -if os.environ.get('USE_DOCKER') == 'yes': +if env('USE_DOCKER') == 'yes': + import socket hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) INTERNAL_IPS += [ip[:-1] + '1' for ip in ips] {%- endif %} From a07327459c50a9e560c4d19c52eea1b7203a082b Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 9 May 2018 13:24:08 +0300 Subject: [PATCH 04/65] Fix logging module imported unconditionally in production.py --- {{cookiecutter.project_slug}}/config/settings/production.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 24df1886..c032d996 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -1,5 +1,3 @@ -import logging - from .base import * # noqa from .base import env @@ -235,6 +233,8 @@ LOGGING = { }, } +import logging + SENTRY_CELERY_LOGLEVEL = env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO) RAVEN_CONFIG = { 'dsn': SENTRY_DSN From 661fc3e449c779ad3fa2bad8964b6b7082f88ca3 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 9 May 2018 13:42:20 +0300 Subject: [PATCH 05/65] Fix E402 --- {{cookiecutter.project_slug}}/config/settings/production.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index c032d996..224081aa 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -1,3 +1,7 @@ +{% if cookiecutter.use_sentry == 'y' -%} +import logging + +{% endif -%} from .base import * # noqa from .base import env @@ -233,8 +237,6 @@ LOGGING = { }, } -import logging - SENTRY_CELERY_LOGLEVEL = env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO) RAVEN_CONFIG = { 'dsn': SENTRY_DSN From b1bec7b37fda6997b6a8c98abb09f7474da82c1d Mon Sep 17 00:00:00 2001 From: Jannis Gebauer Date: Thu, 10 May 2018 23:11:57 +0200 Subject: [PATCH 06/65] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 4899c4f9..37a905b9 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,4 +1,4 @@ -**Note: for support questions, please use the `cookiecutter-django` tag on stackoverflow**. This repository's issues are reserved for feature requests and bug reports. If you need quick professional paid support for your project, contact support@cookiecutter.io. +**Note: for support questions, please use the `cookiecutter-django` tag on stackoverflow**. This repository's issues are reserved for feature requests and bug reports. * **I'm submitting a ... ** - [ ] bug report From fac121a73b731f5892999bce003703cc1d2aa893 Mon Sep 17 00:00:00 2001 From: Jannis Gebauer Date: Thu, 10 May 2018 23:12:49 +0200 Subject: [PATCH 07/65] Update README.rst --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index acb5d6a1..25f42194 100644 --- a/README.rst +++ b/README.rst @@ -27,9 +27,6 @@ production-ready Django projects quickly. * See Troubleshooting_ for common errors and obstacles * If you have problems with Cookiecutter Django, please open issues_ don't send emails to the maintainers. -* Need quick professional paid support? Contact `support@cookiecutter.io`_. - This includes configuring your servers, fixing bugs, reviewing your code and - everything in between. .. _cookiecutter: https://github.com/audreyr/cookiecutter @@ -37,7 +34,6 @@ production-ready Django projects quickly. .. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373 .. _issues: https://github.com/pydanny/cookiecutter-django/issues/new -.. _support@cookiecutter.io: support@cookiecutter.io Features --------- From 144f4ca3b7873d43f916d6ca26fff69c2593ad4c Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 10 May 2018 23:16:42 +0200 Subject: [PATCH 08/65] Update django-model-utils from 3.1.1 to 3.1.2 (#1640) --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 92d31f46..094eefee 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -17,7 +17,7 @@ celery==3.1.25 # pyup: <4.0 # https://github.com/celery/celery # ------------------------------------------------------------------------------ django==2.0.5 # pyup: < 2.1 # https://www.djangoproject.com/ django-environ==0.4.4 # https://github.com/joke2k/django-environ -django-model-utils==3.1.1 # https://github.com/jazzband/django-model-utils +django-model-utils==3.1.2 # https://github.com/jazzband/django-model-utils django-allauth==0.36.0 # https://github.com/pennersr/django-allauth django-crispy-forms==1.7.2 # https://github.com/django-crispy-forms/django-crispy-forms {%- if cookiecutter.use_compressor == "y" %} From dbdedb81c11b98a16990f2ab95c77995a79618e9 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 12 May 2018 21:57:24 +0200 Subject: [PATCH 09/65] Update raven from 6.7.0 to 6.8.0 (#1642) --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 95338849..e36dc78a 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==0.6.2 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -raven==6.7.0 # https://github.com/getsentry/raven-python +raven==6.8.0 # https://github.com/getsentry/raven-python {%- endif %} # Django From be1024cd0643b6452fb5854db757d6116a531324 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Sun, 13 May 2018 13:51:01 +0300 Subject: [PATCH 10/65] Drop Grunt support Closes #1636. --- cookiecutter.json | 7 +- docs/project-generation-options.rst | 6 +- hooks/post_gen_project.py | 15 +-- {{cookiecutter.project_slug}}/.gitignore | 3 - {{cookiecutter.project_slug}}/Gruntfile.js | 144 --------------------- {{cookiecutter.project_slug}}/package.json | 28 +--- 6 files changed, 9 insertions(+), 194 deletions(-) delete mode 100644 {{cookiecutter.project_slug}}/Gruntfile.js diff --git a/cookiecutter.json b/cookiecutter.json index e6687822..d1c0b26d 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -2,9 +2,9 @@ "project_name": "My Awesome Project", "project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}", "description": "Behold My Awesome Project!", - "author_name": "Daniel Roy Greenfeld", - "email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com", + "author_name": "{{ cookiecutter.project_slug }}", "domain_name": "example.com", + "email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com", "version": "0.1.0", "open_source_license": [ "MIT", @@ -28,8 +28,7 @@ ], "js_task_runner": [ "None", - "Gulp", - "Grunt" + "Gulp" ], "custom_bootstrap_compilation": "n", "use_compressor": "n", diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 4c46cbdc..476d65af 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -60,9 +60,8 @@ postgresql_version [1] js_task_runner [1] Select a JavaScript task runner. The choices are: - 1. Gulp_ - 2. Grunt_ - 3. None + 1. None + 2. Gulp_ custom_bootstrap_compilation [n] Indicates whether the project should support Bootstrap recompilation @@ -114,7 +113,6 @@ debug [n] .. _PostgreSQL: https://www.postgresql.org/docs/ .. _Gulp: https://github.com/gulpjs/gulp -.. _Grunt: https://github.com/gruntjs/grunt .. _Django Compressor: https://github.com/django-compressor/django-compressor diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 5e60b23a..884590ac 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -67,12 +67,6 @@ def remove_heroku_files(): os.remove(file_name) -def remove_grunt_files(): - file_names = ["Gruntfile.js"] - for file_name in file_names: - os.remove(file_name) - - def remove_gulp_files(): file_names = ["gulpfile.js"] for file_name in file_names: @@ -264,16 +258,11 @@ def main(): if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y": append_to_gitignore_file("!.envs/.local/") - if "{{ cookiecutter.js_task_runner}}".lower() == "gulp": - remove_grunt_files() - elif "{{ cookiecutter.js_task_runner}}".lower() == "grunt": + if "{{ cookiecutter.js_task_runner}}".lower() == "none": remove_gulp_files() - else: - remove_gulp_files() - remove_grunt_files() remove_packagejson_file() if ( - "{{ cookiecutter.js_task_runner }}".lower() in ["grunt", "gulp"] + "{{ cookiecutter.js_task_runner }}".lower() != "none" and "{{ cookiecutter.use_docker }}".lower() == "y" ): print( diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 84b7e6d6..3cabaac2 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -105,9 +105,6 @@ coverage # nyc test coverage .nyc_output -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - # Bower dependency directory (https://bower.io/) bower_components diff --git a/{{cookiecutter.project_slug}}/Gruntfile.js b/{{cookiecutter.project_slug}}/Gruntfile.js deleted file mode 100644 index b225266c..00000000 --- a/{{cookiecutter.project_slug}}/Gruntfile.js +++ /dev/null @@ -1,144 +0,0 @@ -module.exports = function (grunt) { - - var appConfig = grunt.file.readJSON('package.json'); - - // Load grunt tasks automatically - // see: https://github.com/sindresorhus/load-grunt-tasks - require('load-grunt-tasks')(grunt); - - // Time how long tasks take. Can help when optimizing build times - // see: https://npmjs.org/package/time-grunt - require('time-grunt')(grunt); - - var pathsConfig = function (appName) { - this.app = appName || appConfig.name; - - return { - app: this.app, - templates: this.app + '/templates', - css: this.app + '/static/css', - sass: this.app + '/static/sass', - fonts: this.app + '/static/fonts', - images: this.app + '/static/images', - js: this.app + '/static/js', - manageScript: 'manage.py', - } - }; - - grunt.initConfig({ - - paths: pathsConfig(), - pkg: appConfig, - - // see: https://github.com/gruntjs/grunt-contrib-watch - watch: { - gruntfile: { - files: ['Gruntfile.js'] - }, - sass: { - files: ['<%= paths.sass %>/**/*.{scss,sass}'], - tasks: ['sass:dev'], - options: { - atBegin: true - } - }, - livereload: { - files: [ - '<%= paths.js %>/**/*.js', - '<%= paths.sass %>/**/*.{scss,sass}', - '<%= paths.app %>/**/*.html' - ], - options: { - spawn: false, - livereload: true, - }, - }, - }, - - // see: https://github.com/sindresorhus/grunt-sass - sass: { - dev: { - options: { - outputStyle: 'nested', -{% if cookiecutter.custom_bootstrap_compilation == 'y' %} - includePaths: ['node_modules/bootstrap/scss'], -{% endif %} - sourceMap: false, - precision: 10 - }, - files: { - '<%= paths.css %>/project.css': '<%= paths.sass %>/project.scss' - }, - }, - dist: { - options: { - outputStyle: 'compressed', -{% if cookiecutter.custom_bootstrap_compilation == 'y' %} - includePaths: ['node_modules/bootstrap/scss'], -{% endif %} - sourceMap: false, - precision: 10 - }, - files: { - '<%= paths.css %>/project.css': '<%= paths.sass %>/project.scss' - }, - } - }, - - //see https://github.com/nDmitry/grunt-postcss - postcss: { - options: { - map: true, // inline sourcemaps - - processors: [ - require('pixrem')(), // add fallbacks for rem units - require('autoprefixer')({browsers: [ - 'Android 2.3', - 'Android >= 4', - 'Chrome >= 20', - 'Firefox >= 24', - 'Explorer >= 8', - 'iOS >= 6', - 'Opera >= 12', - 'Safari >= 6' - ]}), // add vendor prefixes - require('cssnano')() // minify the result - ] - }, - dist: { - src: '<%= paths.css %>/*.css' - } - }, - - // see: https://npmjs.org/package/grunt-bg-shell - bgShell: { - _defaults: { - bg: true - }, - runDjango: { - cmd: 'python <%= paths.manageScript %> runserver' - }, - {% if cookiecutter.use_mailhog == "y" and cookiecutter.use_docker == 'n' -%}runMailHog: { - cmd: './mailhog' - },{%- endif %} - } - }); - - grunt.registerTask('serve', [ - {% if cookiecutter.use_mailhog == "y" and cookiecutter.use_docker == 'n' -%} - 'bgShell:runMailHog', - {%- endif %} - 'bgShell:runDjango', - 'watch' - ]); - - grunt.registerTask('build', [ - 'sass:dist', - 'postcss' - ]); - - grunt.registerTask('default', [ - 'build' - ]); - -}; diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index acaae12a..f32c41a2 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -3,28 +3,7 @@ "version": "{{ cookiecutter.version }}", "dependencies": {}, "devDependencies": { - {% if cookiecutter.js_task_runner == 'Grunt' %} - "autoprefixer": "~8.1.0", - {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - "bootstrap": "^4.0.0", - {% endif %} - "connect-livereload": "~0.6.0", - "cssnano": "~3.10.0", - "grunt": "~1.0.2", - "grunt-bg-shell": "~2.3.1", - "grunt-contrib-watch": "~1.0.0", - "grunt-postcss": "~0.9.0", - "grunt-sass": "~2.1.0", - {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - "jquery": "^3.2.1-slim", - {% endif %} - "load-grunt-tasks": "~3.2.0", - "pixrem": "~4.0.1", - {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - "popper.js": "^1.12.3", - {% endif %} - "time-grunt": "~1.2.1" - {% elif cookiecutter.js_task_runner == 'Gulp' %} + {% if cookiecutter.js_task_runner == 'Gulp' %} {% if cookiecutter.custom_bootstrap_compilation == 'y' %} "bootstrap": "^4.0.0", {% endif %} @@ -54,11 +33,8 @@ "node": ">=0.8.0" }, "scripts": { - {% if cookiecutter.js_task_runner == 'Grunt' %} - "dev": "grunt serve" - {% elif cookiecutter.js_task_runner == 'Gulp' %} + {% if cookiecutter.js_task_runner == 'Gulp' %} "dev": "gulp" {% endif %} - } } From fe110ddd5ffa99aa367ebbf79203ef94e45eed60 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Sun, 13 May 2018 15:09:11 +0300 Subject: [PATCH 11/65] Fix inadvertently changed author_name --- cookiecutter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index d1c0b26d..cb41bbfc 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -2,7 +2,7 @@ "project_name": "My Awesome Project", "project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}", "description": "Behold My Awesome Project!", - "author_name": "{{ cookiecutter.project_slug }}", + "author_name": "Daniel Roy Greenfeld", "domain_name": "example.com", "email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com", "version": "0.1.0", From fd15b20a0832cf6a8b067a3eca2fdd7dd8f7a850 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Sun, 13 May 2018 17:02:54 +0300 Subject: [PATCH 12/65] Use string interpolation in production STATIC_URL --- {{cookiecutter.project_slug}}/config/settings/production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 224081aa..b9b0ea0c 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -89,7 +89,7 @@ AWS_S3_OBJECT_PARAMETERS = { STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' {%- else %} STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage' -STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME +STATIC_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/static/' {%- endif %} # MEDIA From 6d4be405d83fa4a630db31e45407a25c0a1b2abd Mon Sep 17 00:00:00 2001 From: saschalalala Date: Mon, 14 May 2018 09:09:24 +0200 Subject: [PATCH 13/65] Migrate to Django2 path urls (#1637) * Change users urls to Django 2 paths * Change config urls to Django 2 paths * Change admin url setting to Django 2 path syntax * Replace more admin urls * Add myself to contributors.rst --- CONTRIBUTORS.rst | 1 + docs/deployment-on-heroku.rst | 2 +- docs/settings.rst | 2 +- hooks/post_gen_project.py | 2 +- .../config/settings/base.py | 4 +-- {{cookiecutter.project_slug}}/config/urls.py | 32 +++++++++---------- .../users/urls.py | 12 +++---- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 8fbe4771..a5ea2d93 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -141,6 +141,7 @@ Listed in alphabetical order. Roman Afanaskin `@siauPatrick`_ Roman Osipenko `@romanosipenko`_ Russell Davies + Sascha `@saschalalala` @saschalalala Sam Collins `@MightySCollins`_ Shupeyko Nikita `@webyneter`_ SÅ‚awek Ehlert `@slafs`_ diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index 1f249c44..203d2ce0 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -18,7 +18,7 @@ Run these commands to deploy the project to Heroku: heroku config:set WEB_CONCURRENCY=4 # Generating a 32 character-long random string without any of the visually similiar characters "IOl01": - heroku config:set DJANGO_ADMIN_URL="^$(openssl rand -base64 4096 | tr -dc 'A-HJ-NP-Za-km-z2-9' | head -c 32)/" + heroku config:set DJANGO_ADMIN_URL="$(openssl rand -base64 4096 | tr -dc 'A-HJ-NP-Za-km-z2-9' | head -c 32)/" heroku config:set DJANGO_SECRET_KEY="$(openssl rand -base64 64)" heroku config:set DJANGO_SETTINGS_MODULE=config.settings.production heroku config:set DJANGO_ALLOWED_HOSTS='.herokuapp.com' diff --git a/docs/settings.rst b/docs/settings.rst index 7962f715..60593a5d 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -18,7 +18,7 @@ DJANGO_READ_DOT_ENV_FILE READ_DOT_ENV_FILE False ======================================= =========================== ============================================== ====================================================================== Environment Variable Django Setting Development Default Production Default ======================================= =========================== ============================================== ====================================================================== -DJANGO_ADMIN_URL n/a r'^admin/' raises error +DJANGO_ADMIN_URL n/a 'admin/' raises error DJANGO_CACHES CACHES (default) locmem redis DJANGO_DATABASES DATABASES (default) See code See code DJANGO_DEBUG DEBUG True False diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 884590ac..6b48471e 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -154,7 +154,7 @@ def set_django_admin_url(file_path): django_admin_url = set_flag( file_path, "!!!SET DJANGO_ADMIN_URL!!!", - formatted="^{}/", + formatted="{}/", length=32, using_digits=True, using_ascii_letters=True, diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 7167d6f2..e767d5df 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -216,8 +216,8 @@ EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.s # ADMIN # ------------------------------------------------------------------------------ -# Django Admin URL regex. -ADMIN_URL = r'^admin/' +# Django Admin URL. +ADMIN_URL = 'admin/' # https://docs.djangoproject.com/en/dev/ref/settings/#admins ADMINS = [ ("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'), diff --git a/{{cookiecutter.project_slug}}/config/urls.py b/{{cookiecutter.project_slug}}/config/urls.py index 2a126f6e..62d86c94 100644 --- a/{{cookiecutter.project_slug}}/config/urls.py +++ b/{{cookiecutter.project_slug}}/config/urls.py @@ -1,25 +1,25 @@ from django.conf import settings -from django.conf.urls import include, url +from django.urls import include, path from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView from django.views import defaults as default_views urlpatterns = [ - url(r"^$", TemplateView.as_view(template_name="pages/home.html"), name="home"), - url( - r"^about/$", + path("", TemplateView.as_view(template_name="pages/home.html"), name="home"), + path( + "about/", TemplateView.as_view(template_name="pages/about.html"), name="about", ), # Django Admin, use {% raw %}{% url 'admin:index' %}{% endraw %} - url(settings.ADMIN_URL, admin.site.urls), + path(settings.ADMIN_URL, admin.site.urls), # User management - url( - r"^users/", + path( + "users/", include("{{ cookiecutter.project_slug }}.users.urls", namespace="users"), ), - url(r"^accounts/", include("allauth.urls")), + path("accounts/", include("allauth.urls")), # Your stuff: custom urls includes go here ] + static( settings.MEDIA_URL, document_root=settings.MEDIA_ROOT @@ -29,24 +29,24 @@ if settings.DEBUG: # This allows the error pages to be debugged during development, just visit # these url in browser to see how these error pages look like. urlpatterns += [ - url( - r"^400/$", + path( + "400/", default_views.bad_request, kwargs={"exception": Exception("Bad Request!")}, ), - url( - r"^403/$", + path( + "403/", default_views.permission_denied, kwargs={"exception": Exception("Permission Denied")}, ), - url( - r"^404/$", + path( + "404/", default_views.page_not_found, kwargs={"exception": Exception("Page not Found")}, ), - url(r"^500/$", default_views.server_error), + path("500/", default_views.server_error), ] if "debug_toolbar" in settings.INSTALLED_APPS: import debug_toolbar - urlpatterns = [url(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns + urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py index 69414f47..a98e63b8 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py @@ -1,14 +1,14 @@ -from django.conf.urls import url +from django.urls import path from . import views app_name = "users" urlpatterns = [ - url(regex=r"^$", view=views.UserListView.as_view(), name="list"), - url(regex=r"^~redirect/$", view=views.UserRedirectView.as_view(), name="redirect"), - url(regex=r"^~update/$", view=views.UserUpdateView.as_view(), name="update"), - url( - regex=r"^(?P[\w.@+-]+)/$", + path("", view=views.UserListView.as_view(), name="list"), + path("~redirect/", view=views.UserRedirectView.as_view(), name="redirect"), + path("~update/", view=views.UserUpdateView.as_view(), name="update"), + path( + "", view=views.UserDetailView.as_view(), name="detail", ), From 4bcd4c3343d8e2e9765190b1de192f69c36368cf Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 14 May 2018 10:15:51 +0300 Subject: [PATCH 14/65] Don't migrate during Heroku release phase Closes #1646. --- {{cookiecutter.project_slug}}/Procfile | 1 - 1 file changed, 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/Procfile b/{{cookiecutter.project_slug}}/Procfile index 669607fc..c77d76d9 100644 --- a/{{cookiecutter.project_slug}}/Procfile +++ b/{{cookiecutter.project_slug}}/Procfile @@ -1,4 +1,3 @@ -release: manage.py migrate web: gunicorn config.wsgi:application {% if cookiecutter.use_celery == "y" -%} worker: celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info From 091a3b6d0f36669f1d12aa08d5f628fcb4011973 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 14 May 2018 10:20:27 +0300 Subject: [PATCH 15/65] `gunicorn --bind` instead of `gunicorn -b` --- .../compose/production/django/gunicorn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/django/gunicorn.sh b/{{cookiecutter.project_slug}}/compose/production/django/gunicorn.sh index 39679f28..0ad39dfa 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/gunicorn.sh +++ b/{{cookiecutter.project_slug}}/compose/production/django/gunicorn.sh @@ -6,4 +6,4 @@ set -o nounset python /app/manage.py collectstatic --noinput -/usr/local/bin/gunicorn config.wsgi -b 0.0.0.0:5000 --chdir=/app +/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app From c3baadd8c73417e09f5cb8a939926e8e68661404 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 14 May 2018 10:21:33 +0300 Subject: [PATCH 16/65] Set `DEBUG=True` unconditionally in local config --- {{cookiecutter.project_slug}}/config/settings/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index d4f5a27a..ac11eda5 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -4,7 +4,7 @@ from .base import env # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#debug -DEBUG = env.bool('DJANGO_DEBUG', default=True) +DEBUG = True # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = env('DJANGO_SECRET_KEY', default='!!!SET DJANGO_SECRET_KEY!!!') # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts From 105f18efd09a49b86dea384d369c6946a9cc4e3d Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 14 May 2018 08:39:46 +0100 Subject: [PATCH 17/65] Update deployment on Heroku to run migrations - refs #1646 --- docs/deployment-on-heroku.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index 203d2ce0..982168fc 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -33,6 +33,7 @@ Run these commands to deploy the project to Heroku: heroku config:set PYTHONHASHSEED=random git push heroku master + heroku run python manage.py migrate heroku run python manage.py check --deploy heroku run python manage.py createsuperuser heroku open From 39378e3b322bab5c11431f76eefc6c3f4291718f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?= Date: Mon, 14 May 2018 19:01:16 +0700 Subject: [PATCH 18/65] Replace awesome-slugify with python-slugify The former drags us from getting update with new libraries (e.g Unidecode). --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 094eefee..bd7e051b 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,5 +1,5 @@ pytz==2018.4 # https://github.com/stub42/pytz -awesome-slugify==1.6.5 # https://github.com/dimka665/awesome-slugify +python-slugify==1.2.5 # https://github.com/un33k/python-slugify Pillow==5.1.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin From 32f303f619c63fa53e8be60e24ca5a9836eb8066 Mon Sep 17 00:00:00 2001 From: Emile Petrone Date: Sun, 20 May 2018 12:37:36 -0400 Subject: [PATCH 19/65] Added documentation for Docker deployment in detached mode --- docs/deployment-with-docker.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index 90f2fa5c..de0026a6 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -84,6 +84,10 @@ Once this is ready, you can run it with:: docker-compose -f production.yml up +To run the stack and detach the containers, run:: + + docker-compose -f production.yml up -d + To run a migration, open up a second terminal and run:: docker-compose -f production.yml run --rm django python manage.py migrate From 820e3540da9638ed41c380c7d80324f942c00c54 Mon Sep 17 00:00:00 2001 From: Nikita Shupeyko Date: Mon, 21 May 2018 12:44:38 +0300 Subject: [PATCH 20/65] Upgrade Caddy to 0.11 and pin its version to minor rather than patch (#1653) --- .../compose/production/caddy/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/caddy/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/caddy/Dockerfile index d02f0342..8cbbf1df 100644 --- a/{{cookiecutter.project_slug}}/compose/production/caddy/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/caddy/Dockerfile @@ -1,3 +1,3 @@ -FROM abiosoft/caddy:0.10.6 +FROM abiosoft/caddy:0.11 COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile From 9b938647b44142a329e0e3daaf1c99ce202d55d8 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 21 May 2018 14:59:20 +0300 Subject: [PATCH 21/65] Refactor exec "$@" in django entrypoint.sh --- .../compose/production/django/entrypoint.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh index 74242bde..ddf096aa 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh @@ -5,8 +5,6 @@ set -o pipefail set -o nounset -cmd="$@" - # N.B. If only .env files supported variable expansion... export CELERY_BROKER_URL="${REDIS_URL}" @@ -44,4 +42,4 @@ done >&2 echo 'PostgreSQL is up - continuing...' -exec $cmd +exec "$@" From 90953a83f202ddd3a6fa3b7cd58db6a32facbf69 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 21 May 2018 15:03:37 +0300 Subject: [PATCH 22/65] Alter django entrypoint.sh output --- .../compose/production/django/entrypoint.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh index ddf096aa..4845e343 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh @@ -34,12 +34,10 @@ sys.exit(0) END } - until postgres_ready; do - >&2 echo 'PostgreSQL is unavailable (sleeping)...' + >&2 echo 'Waiting for PostgreSQL to become available...' sleep 1 done - ->&2 echo 'PostgreSQL is up - continuing...' +>&2 echo 'PostgreSQL is available' exec "$@" From 849f64e1a52d5d0c1db768a9cd31b10a6e9db414 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 14 May 2018 10:28:50 +0300 Subject: [PATCH 23/65] Remove .sh ext from executable scripts --- .../compose/local/django/Dockerfile | 26 ++++++++-------- .../compose/local/django/celery/beat/start.sh | 10 ------- .../local/django/celery/worker/start.sh | 9 ------ .../compose/local/django/start.sh | 10 ------- .../compose/production/django/Dockerfile | 30 +++++++++---------- .../django/celery/beat/{start.sh => start} | 0 .../django/celery/worker/{start.sh => start} | 0 .../django/{entrypoint.sh => entrypoint} | 0 .../django/{gunicorn.sh => gunicorn} | 0 {{cookiecutter.project_slug}}/local.yml | 6 ++-- {{cookiecutter.project_slug}}/production.yml | 6 ++-- 11 files changed, 34 insertions(+), 63 deletions(-) delete mode 100644 {{cookiecutter.project_slug}}/compose/local/django/celery/beat/start.sh delete mode 100644 {{cookiecutter.project_slug}}/compose/local/django/celery/worker/start.sh delete mode 100644 {{cookiecutter.project_slug}}/compose/local/django/start.sh rename {{cookiecutter.project_slug}}/compose/production/django/celery/beat/{start.sh => start} (100%) rename {{cookiecutter.project_slug}}/compose/production/django/celery/worker/{start.sh => start} (100%) rename {{cookiecutter.project_slug}}/compose/production/django/{entrypoint.sh => entrypoint} (100%) rename {{cookiecutter.project_slug}}/compose/production/django/{gunicorn.sh => gunicorn} (100%) diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index 3e3691d0..df9561f7 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -19,22 +19,22 @@ RUN apk update \ COPY ./requirements /requirements RUN pip install -r /requirements/local.txt -COPY ./compose/production/django/entrypoint.sh /entrypoint.sh -RUN sed -i 's/\r//' /entrypoint.sh -RUN chmod +x /entrypoint.sh +COPY ./compose/production/django/entrypoint /entrypoint +RUN sed -i 's/\r//' /entrypoint +RUN chmod +x /entrypoint -COPY ./compose/local/django/start.sh /start.sh -RUN sed -i 's/\r//' /start.sh -RUN chmod +x /start.sh +COPY ./compose/local/django/start /start +RUN sed -i 's/\r//' /start +RUN chmod +x /start {% if cookiecutter.use_celery == "y" %} -COPY ./compose/local/django/celery/worker/start.sh /start-celeryworker.sh -RUN sed -i 's/\r//' /start-celeryworker.sh -RUN chmod +x /start-celeryworker.sh +COPY ./compose/local/django/celery/worker/start /start-celeryworker +RUN sed -i 's/\r//' /start-celeryworker +RUN chmod +x /start-celeryworker -COPY ./compose/local/django/celery/beat/start.sh /start-celerybeat.sh -RUN sed -i 's/\r//' /start-celerybeat.sh -RUN chmod +x /start-celerybeat.sh +COPY ./compose/local/django/celery/beat/start /start-celerybeat +RUN sed -i 's/\r//' /start-celerybeat +RUN chmod +x /start-celerybeat {% endif %} WORKDIR /app -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint"] diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start.sh b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start.sh deleted file mode 100644 index 0ca8bb50..00000000 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -o errexit -set -o pipefail -set -o nounset -set -o xtrace - - -rm -f './celerybeat.pid' -celery -A {{cookiecutter.project_slug}}.taskapp beat -l INFO diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start.sh b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start.sh deleted file mode 100644 index 4335340d..00000000 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -o errexit -set -o pipefail -set -o nounset -set -o xtrace - - -celery -A {{cookiecutter.project_slug}}.taskapp worker -l INFO diff --git a/{{cookiecutter.project_slug}}/compose/local/django/start.sh b/{{cookiecutter.project_slug}}/compose/local/django/start.sh deleted file mode 100644 index 50227e19..00000000 --- a/{{cookiecutter.project_slug}}/compose/local/django/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -o errexit -set -o pipefail -set -o nounset -set -o xtrace - - -python manage.py migrate -python manage.py runserver_plus 0.0.0.0:8000 diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index e8d2e0fc..04ac0d55 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -19,23 +19,23 @@ COPY ./requirements /requirements RUN pip install --no-cache-dir -r /requirements/production.txt \ && rm -rf /requirements -COPY ./compose/production/django/gunicorn.sh /gunicorn.sh -RUN sed -i 's/\r//' /gunicorn.sh -RUN chmod +x /gunicorn.sh -RUN chown django /gunicorn.sh +COPY ./compose/production/django/gunicorn /gunicorn +RUN sed -i 's/\r//' /gunicorn +RUN chmod +x /gunicorn +RUN chown django /gunicorn -COPY ./compose/production/django/entrypoint.sh /entrypoint.sh -RUN sed -i 's/\r//' /entrypoint.sh -RUN chmod +x /entrypoint.sh -RUN chown django /entrypoint.sh +COPY ./compose/production/django/entrypoint /entrypoint +RUN sed -i 's/\r//' /entrypoint +RUN chmod +x /entrypoint +RUN chown django /entrypoint {% if cookiecutter.use_celery == "y" %} -COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh -RUN sed -i 's/\r//' /start-celeryworker.sh -RUN chmod +x /start-celeryworker.sh +COPY ./compose/production/django/celery/worker/start /start-celeryworker +RUN sed -i 's/\r//' /start-celeryworker +RUN chmod +x /start-celeryworker -COPY ./compose/production/django/celery/beat/start.sh /start-celerybeat.sh -RUN sed -i 's/\r//' /start-celerybeat.sh -RUN chmod +x /start-celerybeat.sh +COPY ./compose/production/django/celery/beat/start /start-celerybeat +RUN sed -i 's/\r//' /start-celerybeat +RUN chmod +x /start-celerybeat {% endif %} COPY . /app @@ -45,4 +45,4 @@ USER django WORKDIR /app -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint"] diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start.sh b/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start similarity index 100% rename from {{cookiecutter.project_slug}}/compose/production/django/celery/beat/start.sh rename to {{cookiecutter.project_slug}}/compose/production/django/celery/beat/start diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start.sh b/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start similarity index 100% rename from {{cookiecutter.project_slug}}/compose/production/django/celery/worker/start.sh rename to {{cookiecutter.project_slug}}/compose/production/django/celery/worker/start diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint similarity index 100% rename from {{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh rename to {{cookiecutter.project_slug}}/compose/production/django/entrypoint diff --git a/{{cookiecutter.project_slug}}/compose/production/django/gunicorn.sh b/{{cookiecutter.project_slug}}/compose/production/django/gunicorn similarity index 100% rename from {{cookiecutter.project_slug}}/compose/production/django/gunicorn.sh rename to {{cookiecutter.project_slug}}/compose/production/django/gunicorn diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index d22a9d08..c725fff7 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -22,7 +22,7 @@ services: - ./.envs/.local/.postgres ports: - "8000:8000" - command: /start.sh + command: /start postgres: build: @@ -60,7 +60,7 @@ services: - ./.envs/.local/.django - ./.envs/.local/.postgres ports: [] - command: /start-celeryworker.sh + command: /start-celeryworker celerybeat: <<: *django @@ -75,6 +75,6 @@ services: - ./.envs/.local/.django - ./.envs/.local/.postgres ports: [] - command: /start-celerybeat.sh + command: /start-celerybeat {%- endif %} diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml index f8f8ca22..51c89627 100644 --- a/{{cookiecutter.project_slug}}/production.yml +++ b/{{cookiecutter.project_slug}}/production.yml @@ -17,7 +17,7 @@ services: env_file: - ./.envs/.production/.django - ./.envs/.production/.postgres - command: /gunicorn.sh + command: /gunicorn postgres: build: @@ -58,7 +58,7 @@ services: env_file: - ./.envs/.production/.django - ./.envs/.production/.postgres - command: /start-celeryworker.sh + command: /start-celeryworker celerybeat: <<: *django @@ -69,6 +69,6 @@ services: env_file: - ./.envs/.production/.django - ./.envs/.production/.postgres - command: /start-celerybeat.sh + command: /start-celerybeat {%- endif %} From cfff5b9d0866c8ec5dfc0a5a275a9d17f4ce1b3f Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 21 May 2018 15:34:28 +0300 Subject: [PATCH 24/65] Commit local django celery start scripts back --- .../compose/local/django/celery/beat/start | 10 ++++++++++ .../compose/local/django/celery/worker/start | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/compose/local/django/celery/beat/start create mode 100644 {{cookiecutter.project_slug}}/compose/local/django/celery/worker/start diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start new file mode 100644 index 00000000..0ca8bb50 --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start @@ -0,0 +1,10 @@ +#!/bin/sh + +set -o errexit +set -o pipefail +set -o nounset +set -o xtrace + + +rm -f './celerybeat.pid' +celery -A {{cookiecutter.project_slug}}.taskapp beat -l INFO diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start new file mode 100644 index 00000000..4335340d --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start @@ -0,0 +1,9 @@ +#!/bin/sh + +set -o errexit +set -o pipefail +set -o nounset +set -o xtrace + + +celery -A {{cookiecutter.project_slug}}.taskapp worker -l INFO From 4a1ea2fb458862e1e4e0704ad0659b6408b1c4bb Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 21 May 2018 15:39:12 +0300 Subject: [PATCH 25/65] Commit local django start scripts back --- .../compose/local/django/start | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/compose/local/django/start diff --git a/{{cookiecutter.project_slug}}/compose/local/django/start b/{{cookiecutter.project_slug}}/compose/local/django/start new file mode 100644 index 00000000..50227e19 --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/local/django/start @@ -0,0 +1,10 @@ +#!/bin/sh + +set -o errexit +set -o pipefail +set -o nounset +set -o xtrace + + +python manage.py migrate +python manage.py runserver_plus 0.0.0.0:8000 From 8e429d7e3d5ad785b12f761b27197bd31ef5da27 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Mon, 21 May 2018 16:20:16 +0300 Subject: [PATCH 26/65] Update PyCharm configs with respect to the latest IDE version --- {{cookiecutter.project_slug}}/.idea/misc.xml | 6 ++++ .../.idea/modules.xml | 8 +++++ .../runConfigurations/Docker__runserver.xml | 33 ------------------- .../merge_production_dotenvs_in_dotenv.xml | 2 +- .../{Docker__migrate.xml => migrate.xml} | 8 ++--- .../.idea/runConfigurations/runserver.xml | 33 +++++++++++++++++++ ..._runserver_plus.xml => runserver_plus.xml} | 8 ++--- ...ocker__tests___all.xml => tests___all.xml} | 6 ++-- ...stUser.xml => tests___class__TestUser.xml} | 6 ++-- ...dels.xml => tests___file__test_models.xml} | 6 ++-- ...e__users.xml => tests___module__users.xml} | 6 ++-- ...sts___specific__test_get_absolute_url.xml} | 6 ++-- {{cookiecutter.project_slug}}/.idea/vcs.xml | 2 +- .../.idea/{{cookiecutter.project_slug}}.iml | 19 +++++++++-- 14 files changed, 88 insertions(+), 61 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/.idea/misc.xml create mode 100644 {{cookiecutter.project_slug}}/.idea/modules.xml delete mode 100644 {{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__runserver.xml rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__migrate.xml => migrate.xml} (80%) create mode 100644 {{cookiecutter.project_slug}}/.idea/runConfigurations/runserver.xml rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__runserver_plus.xml => runserver_plus.xml} (81%) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__tests___all.xml => tests___all.xml} (83%) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__tests___class__TestUser.xml => tests___class__TestUser.xml} (83%) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__tests___file__test_models.xml => tests___file__test_models.xml} (82%) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__tests___module__users.xml => tests___module__users.xml} (82%) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{Docker__tests___specific__test_get_absolute_url.xml => tests___specific__test_get_absolute_url.xml} (82%) diff --git a/{{cookiecutter.project_slug}}/.idea/misc.xml b/{{cookiecutter.project_slug}}/.idea/misc.xml new file mode 100644 index 00000000..10af178f --- /dev/null +++ b/{{cookiecutter.project_slug}}/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/{{cookiecutter.project_slug}}/.idea/modules.xml b/{{cookiecutter.project_slug}}/.idea/modules.xml new file mode 100644 index 00000000..1418fcdd --- /dev/null +++ b/{{cookiecutter.project_slug}}/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__runserver.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__runserver.xml deleted file mode 100644 index 77b9a587..00000000 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__runserver.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml index 18f8365a..cf2c5dd8 100644 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml +++ b/{{cookiecutter.project_slug}}/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml @@ -1,5 +1,6 @@ +