From a25c57f0f4ad18fb1761f4dc4cdf6dea78d3b689 Mon Sep 17 00:00:00 2001 From: Meghan Heintz Date: Thu, 2 Jun 2016 18:28:50 -0700 Subject: [PATCH 01/56] postgres installation guide for mac, windows IP (#571) * postgres installation guide for mac windows IP * postgres install guide for mac ip windows --- docs/installing_postgres.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/installing_postgres.rst diff --git a/docs/installing_postgres.rst b/docs/installing_postgres.rst new file mode 100644 index 000000000..3b37e8196 --- /dev/null +++ b/docs/installing_postgres.rst @@ -0,0 +1,17 @@ +PostgreSQL Installation Basics +============================== + +.. index:: pip, virtualenv, PostgreSQL + +The steps below will get you up and running with PostgreSQL. This assumes you have pip and virtualenv_ installed. + +.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/ + +On Mac + +Install PostgreSQLapp_ from the browser and move PostGresSQL into your applications folder. Then install PostgreSQL from HomeBrew_. + + $ brew install postgres + +.. _PostgreSQLapp: http://postgresapp.com/ +.. _HomeBrew: http://brew.sh/ \ No newline at end of file From 6b9c6cbe64245ef1850b8ab864804c019a848dcc Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Thu, 2 Jun 2016 18:34:09 -0700 Subject: [PATCH 02/56] Add @dot2dotseurat to changelog and history --- CHANGELOG.md | 4 ++++ CONTRIBUTORS.rst | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76ba8fba5..0f8491530 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +##[2016-06-02] +### Added +- Added better instructions for installing postgres on Mac OS X (@dot2dotseurat ) + ##[2016-05-22] ### Added - Added instructions for copying backups from docker to host (@phiberjenz) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 2fda7c634..4e0bc3bc5 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -96,6 +96,7 @@ Listed in alphabetical order. Matt Linares Matt Menzenski `@menzenski`_ Matt Warren `@mfwarren`_ + Meghan Heintz `@dot2dotseurat`_ mozillazg `@mozillazg`_ Pablo `@oubiga`_ Raphael Pierzina `@hackebrot`_ @@ -135,6 +136,7 @@ Listed in alphabetical order. .. _@ChrisPappalardo: https://github.com/ChrisPappalardo .. _@Collederas: https://github.com/Collederas .. _@ddiazpinto: https://github.com/ddiazpinto +.. _@dot2dotseurat: https://github.com/dot2dotseurat .. _@dsclementsen: https://github.com/dsclementsen .. _@epileptic-fish: https://gihub.com/epileptic-fish .. _@eraldo: https://github.com/eraldo From 0328032cbf9647ae6b18ae33a2e14a55e19de938 Mon Sep 17 00:00:00 2001 From: Vivian Guillen Date: Thu, 2 Jun 2016 18:57:01 -0700 Subject: [PATCH 03/56] Add bigger comments to better section the css --- .../static/sass/project.scss | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss index e737d593f..bbb2da283 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss @@ -1,5 +1,10 @@ + // project specific CSS goes here +//////////////////////////////// + //Variables// +//////////////////////////////// + // Alert colors $white: #fff; @@ -9,6 +14,10 @@ $pink: #f2dede; $dark-pink: #eed3d7; $red: #b94a48; +//////////////////////////////// + //Alerts// +//////////////////////////////// + // bootstrap alert CSS, translated to the django-standard levels of // debug, info, success, warning, error @@ -24,6 +33,10 @@ $red: #b94a48; color: $red; } +//////////////////////////////// + //Navbar// +//////////////////////////////// + // This is a fix for the bootstrap4 alpha release @media (max-width: 47.9em) { @@ -42,6 +55,10 @@ $red: #b94a48; } } +//////////////////////////////// + //Django Toolbar// +//////////////////////////////// + // Display django-debug-toolbar. // See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742 // and https://github.com/pydanny/cookiecutter-django/issues/317 From 329ff5755152d1601dc7839332de9ec8c63aebce Mon Sep 17 00:00:00 2001 From: mjsisley Date: Fri, 3 Jun 2016 06:04:16 -0700 Subject: [PATCH 04/56] Adding documentation for debugging with Docker --- docs/developing-locally-docker.rst | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst index 03e9221c5..58817c9c8 100644 --- a/docs/developing-locally-docker.rst +++ b/docs/developing-locally-docker.rst @@ -141,3 +141,45 @@ If you want to run the stack in detached mode (in the background), use the ``-d` :: $ docker-compose -f dev.yml up -d + +Debugging +~~~~~~~~~~~~~ + +ipdb +""""" + +If you are using the following within your code to debug: + +:: + + import ipdb; ipdb.set_trace() + +Then you may need to run the following for it to work as desired: + +:: + + $ docker-compose run --service-ports django + +django-debug-toolbar +"""""""""""""""""""" + +In order for django-debug-toolbar to work with docker you need to add your docker-machine ip address (the output of `Get the IP ADDRESS`_) to INTERNAL_IPS in local.py + + +.. May be a better place to put this, as it is not Docker specific. + +You may need to add the following to your css in order for the django-debug-toolbar to be visible (this applies whether Docker is being used or not): + +.. code-block:: css + + /* Override Bootstrap 4 styling on Django Debug Toolbar */ + #djDebug[hidden], #djDebug [hidden] { + display: block !important; + } + + #djDebug [hidden][style='display: none;'] { + display: none !important; + } + + + From b8e02d21890a557fee447c0024ab8e8042303023 Mon Sep 17 00:00:00 2001 From: mjsisley Date: Fri, 3 Jun 2016 08:07:39 -0700 Subject: [PATCH 05/56] Add certbot(letsencrypt) support for docker --- CONTRIBUTORS.rst | 2 + cookiecutter.json | 1 + docs/deployment-with-docker.rst | 44 +++++++++ hooks/post_gen_project.py | 33 +++++-- .../compose/nginx/Dockerfile | 9 +- .../compose/nginx/dhparams.example.pem | 3 + .../compose/nginx/nginx-secure.conf | 92 +++++++++++++++++++ .../compose/nginx/nginx.conf | 37 ++++++-- .../compose/nginx/start.sh | 81 ++++++++++++++++ .../docker-compose.yml | 30 +++++- 10 files changed, 312 insertions(+), 20 deletions(-) create mode 100755 {{cookiecutter.project_slug}}/compose/nginx/dhparams.example.pem create mode 100755 {{cookiecutter.project_slug}}/compose/nginx/nginx-secure.conf create mode 100755 {{cookiecutter.project_slug}}/compose/nginx/start.sh diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4e0bc3bc5..b6de7a3c0 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -96,6 +96,7 @@ Listed in alphabetical order. Matt Linares Matt Menzenski `@menzenski`_ Matt Warren `@mfwarren`_ + Matthew Sisley `@mjsisley`_ Meghan Heintz `@dot2dotseurat`_ mozillazg `@mozillazg`_ Pablo `@oubiga`_ @@ -175,6 +176,7 @@ Listed in alphabetical order. .. _@yunti: https://github.com/yunti .. _@zcho: https://github.com/zcho .. _@noisy: https://github.com/noisy +.. _@mjsisley: https://github.com/mjsisley Special Thanks ~~~~~~~~~~~~~~ diff --git a/cookiecutter.json b/cookiecutter.json index 8fe7010a2..5ad55886e 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -22,5 +22,6 @@ "use_heroku": "n", "use_grunt": "n", "use_angular": "n", + "use_certbot": "n", "open_source_license": ["MIT", "BSD", "Not open source"] } diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index de3abf7d4..61ed05f49 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -110,3 +110,47 @@ To get the status, run:: If you have errors, you can always check your stack with `docker-compose`. Switch to your projects root directory and run:: docker-compose ps + +If you are using certbot for https, you must do the following before running anything with docker-compose: + +Replace dhparam.pem.example with a generated dhparams.pem file before running anything with docker-compose. You can generate this on ubuntu or OS X by running the following in the project root: + +:: + + $ openssl dhparam -out /path/to/project/compose/nginx/dhparams.pem 2048 + +If you would like to add additional subdomains to your certificate, you must add additional parameters to the certbot command in the `docker-compose.yml` file: + +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" + +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" + +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. + +The certbot certificates expire after 3 months. +If you would like to set up autorenewal of your certificates, the following commands can be put into a bash script: + +:: + + #!/bin/bash + cd + docker-compose run 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 + +And then set a cronjob by running `crontab -e` and placing in it (period can be adjusted as desired): + +0 4 * * 1 /path/to/bashscript/renew_certbot.sh + + + + + + diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index cffb052e8..5f7235504 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -139,6 +139,16 @@ def remove_grunt_files(): PROJECT_DIRECTORY, filename )) +def remove_certbot_files(): + """ + Removes files needed for certbot if it isn't going to be used + """ + nginx_dir_location = os.path.join(PROJECT_DIRECTORY, 'compose/nginx') + for filename in ["nginx-secure.conf", "start.sh", "dhparams.example.pem"]: + os.remove(os.path.join( + nginx_dir_location, filename + )) + # IN PROGRESS # def copy_doc_files(project_directory): # cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir'] @@ -180,8 +190,11 @@ if '{{ cookiecutter.use_docker }}'.lower() != 'y': if '{{ cookiecutter.use_grunt }}'.lower() != 'y': remove_grunt_files() +# 7. Removes all certbot/letsencrypt files if it isn't going to be used +if '{{ cookiecutter.use_certbot }}'.lower() != 'y': + remove_certbot_files() -# 7. Display a warning if use_docker and use_grunt are selected. Grunt isn't supported by our +# 8. Display a warning if use_docker and use_grunt are selected. Grunt isn't supported by our # docker config atm. if '{{ cookiecutter.use_grunt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( @@ -190,13 +203,19 @@ if '{{ cookiecutter.use_grunt }}'.lower() == 'y' and '{{ cookiecutter.use_docker " grunt service to your docker configuration manually." ) -# 7. Display a warning if use_docker and use_mailhog are selected. Mailhog isn't supported by our -# docker config atm. -if '{{ cookiecutter.use_mailhog }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': +# 9. Removes the certbot/letsencrypt files and display a warning if use_certbot is selected and use_docker isn't. +if '{{ cookiecutter.use_certbot }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y': + remove_certbot_files() print( - "You selected to use docker and mailhog. This is NOT supported out of the box for now. You" - " can continue to use the project like you normally would, but you will need to add a " - " mailhog service to your docker configuration manually." + "You selected to use certbot(letsencrypt) and didn't select to use docker. This is NOT supported out of the box for now. You " + "can continue to use the project like you normally would, but you will no certbot files have been included" + ) + +# 10. Directs the user to the documentation if certbot and docker are selected. +if '{{ cookiecutter.use_certbot }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': + print( + "You selected to use certbot(letsencrypt), please see the documentation for instructions on how to use this in production. " + "You must generate a dhparams.pem file before running docker-compose in a production environment." ) # 4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/ diff --git a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile index 196395763..6a08a744b 100644 --- a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile @@ -1,2 +1,9 @@ FROM nginx:latest -ADD nginx.conf /etc/nginx/nginx.conf \ No newline at end of file +COPY nginx.conf /etc/nginx/nginx.conf + +{% if cookiecutter.use_certbot == 'y' and cookiecutter.use_docker == 'y' %} +COPY start.sh /start.sh +COPY nginx-secure.conf /etc/nginx/nginx-secure.conf +COPY dhparams.pem /etc/ssl/private/dhparams.pem +CMD /start.sh +{% endif %} diff --git a/{{cookiecutter.project_slug}}/compose/nginx/dhparams.example.pem b/{{cookiecutter.project_slug}}/compose/nginx/dhparams.example.pem new file mode 100755 index 000000000..e88d8123f --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/nginx/dhparams.example.pem @@ -0,0 +1,3 @@ +-----BEGIN DH PARAMETERS----- +EXAMPLE_FILE +-----END DH PARAMETERS----- diff --git a/{{cookiecutter.project_slug}}/compose/nginx/nginx-secure.conf b/{{cookiecutter.project_slug}}/compose/nginx/nginx-secure.conf new file mode 100755 index 000000000..78f90279f --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/nginx/nginx-secure.conf @@ -0,0 +1,92 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + +http { + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + proxy_headers_hash_bucket_size 52; + + gzip on; + + upstream app { + server django:5000; + } + server { + listen 80; + server_name ___my.example.com___ www.___my.example.com___; + + location /.well-known/acme-challenge { + proxy_pass http://___LETSENCRYPT_IP___:___LETSENCRYPT_PORT___; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location / { + return 301 https://$server_name$request_uri; + } + + } + + 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_session_cache shared:SSL:10m; + ssl_dhparam /etc/ssl/private/dhparams.pem; + + location /.well-known/acme-challenge { + proxy_pass http://___LETSENCRYPT_HTTPS_IP___:___LETSENCRYPT_HTTPS_PORT___; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto https; + } + + location / { + # checks for static file, if not found proxy to app + try_files $uri @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; + + proxy_pass http://app; + + } + + } + +} diff --git a/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf b/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf index 720b22e5b..54d955d7f 100644 --- a/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf +++ b/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf @@ -9,9 +9,9 @@ events { worker_connections 1024; } - 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" ' @@ -31,23 +31,40 @@ http { server django:5000; } - server { - listen 80; - charset utf-8; + server { + listen 80; + charset utf-8; + {% if cookiecutter.use_certbot == 'y' and cookiecutter.use_docker == 'y' %} + server_name ___my.example.com___ ; - location / { + location /.well-known/acme-challenge { + proxy_pass http://___LETSENCRYPT_IP___:___LETSENCRYPT_PORT___; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto https; + } + + {% endif %} + + location / { # checks for static file, if not found proxy to app try_files $uri @proxy_to_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; proxy_pass http://app; - } - } -} \ No newline at end of file + } + } +} + + + + diff --git a/{{cookiecutter.project_slug}}/compose/nginx/start.sh b/{{cookiecutter.project_slug}}/compose/nginx/start.sh new file mode 100755 index 000000000..2079e194c --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/nginx/start.sh @@ -0,0 +1,81 @@ +echo sleep 5 +sleep 5 + +echo build starting nginx config + + +echo replacing ___my.example.com___/$MY_DOMAIN_NAME +echo replacing ___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR +echo replacing ___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT +echo replacing ___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR +echo replacing ___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT + +# Put your domain name into the nginx reverse proxy config. +sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx.conf +# Add your app's container IP and port into config +sed -i "s/___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR/g" /etc/nginx/nginx.conf +sed -i "s/___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT/g" /etc/nginx/nginx.conf +sed -i "s/___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR/g" /etc/nginx/nginx.conf +sed -i "s/___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT/g" /etc/nginx/nginx.conf + +cat /etc/nginx/nginx.conf +echo . +echo Firing up nginx in the background. +nginx + +# # Check user has specified domain name +if [ -z "$MY_DOMAIN_NAME" ]; then + echo "Need to set MY_DOMAIN_NAME (to a letsencrypt-registered name)." + exit 1 +fi + +# This bit waits until the letsencrypt container has done its thing. +# We see the changes here bceause there's a docker volume mapped. +echo Waiting for folder /etc/letsencrypt/live/$MY_DOMAIN_NAME to exist +while [ ! -d /etc/letsencrypt/live/$MY_DOMAIN_NAME ] ; +do + sleep 2 +done + +while [ ! -f /etc/letsencrypt/live/$MY_DOMAIN_NAME/fullchain.pem ] ; +do + echo Waiting for file fullchain.pem to exist + sleep 2 +done + +while [ ! -f /etc/letsencrypt/live/$MY_DOMAIN_NAME/privkey.pem ] ; +do + echo Waiting for file privkey.pem to exist + sleep 2 +done + +# This is added so that when the certificate is being renewed or is already in place, nginx waits for everything to be good. +sleep 15 + +echo replacing ___my.example.com___/$MY_DOMAIN_NAME +echo replacing ___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR +echo replacing ___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT +echo replacing ___LETSENCRYPT_HTTPS_IP___/$LETSENCRYPT_PORT_443_TCP_ADDR +echo replacing ___LETSENCRYPT_HTTPS_PORT___/$LETSENCRYPT_PORT_443_TCP_PORT +echo replacing ___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR +echo replacing ___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT + + +# Put your domain name into the nginx reverse proxy config. +sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx-secure.conf + +# Add LE container IP and port into config +sed -i "s/___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR/g" /etc/nginx/nginx-secure.conf +sed -i "s/___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT/g" /etc/nginx/nginx-secure.conf +sed -i "s/___LETSENCRYPT_HTTPS_IP___/$LETSENCRYPT_PORT_443_TCP_ADDR/g" /etc/nginx/nginx-secure.conf +sed -i "s/___LETSENCRYPT_HTTPS_PORT___/$LETSENCRYPT_PORT_443_TCP_PORT/g" /etc/nginx/nginx-secure.conf + +# Add your app's container IP and port into config +sed -i "s/___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR/g" /etc/nginx/nginx-secure.conf +sed -i "s/___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT/g" /etc/nginx/nginx-secure.conf + +#go! +kill $(ps aux | grep 'nginx' | awk '{print $2}') +cp /etc/nginx/nginx-secure.conf /etc/nginx/nginx.conf + +nginx -g 'daemon off;' diff --git a/{{cookiecutter.project_slug}}/docker-compose.yml b/{{cookiecutter.project_slug}}/docker-compose.yml index df7ddb49c..a67ec0bb4 100644 --- a/{{cookiecutter.project_slug}}/docker-compose.yml +++ b/{{cookiecutter.project_slug}}/docker-compose.yml @@ -27,12 +27,38 @@ services: build: ./compose/nginx depends_on: - django +{% if cookiecutter.use_certbot == 'y' %} + - certbot +{% endif %} ports: - "0.0.0.0:80:80" +{% if cookiecutter.use_certbot == '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 + - /var/lib/letsencrypt:/var/lib/letsencrypt + + 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" + entrypoint: "" + volumes: + - /etc/letsencrypt:/etc/letsencrypt + - /var/lib/letsencrypt:/var/lib/letsencrypt + ports: + - "80" + - "443" + environment: + - TERM=xterm +{% endif %} redis: image: redis:3.0 - {% if cookiecutter.use_celery == 'y' %} +{% if cookiecutter.use_celery == 'y' %} celeryworker: build: context: . @@ -54,4 +80,4 @@ services: - postgres - redis command: celery -A {{cookiecutter.project_slug}}.taskapp beat -l INFO - {% endif %} +{% endif %} From 4b05499d49d28d103457c5df85e4896ad9da2f1e Mon Sep 17 00:00:00 2001 From: mjsisley Date: Fri, 3 Jun 2016 08:39:45 -0700 Subject: [PATCH 06/56] swap COPY to ADD in nginx Dockerfile --- {{cookiecutter.project_slug}}/compose/nginx/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile index 6a08a744b..addd333ed 100644 --- a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile @@ -1,9 +1,9 @@ FROM nginx:latest -COPY nginx.conf /etc/nginx/nginx.conf +ADD nginx.conf /etc/nginx/nginx.conf {% if cookiecutter.use_certbot == 'y' and cookiecutter.use_docker == 'y' %} -COPY start.sh /start.sh -COPY nginx-secure.conf /etc/nginx/nginx-secure.conf -COPY dhparams.pem /etc/ssl/private/dhparams.pem -CMD /start.sh +ADD start.sh /start.sh +ADD nginx-secure.conf /etc/nginx/nginx-secure.conf +ADD dhparams.pem /etc/ssl/private/dhparams.pem +ADD /start.sh {% endif %} From 0efd49203b5fa44344c5ee07bbc6502959a7a09f Mon Sep 17 00:00:00 2001 From: Leonardo Jimenez Date: Fri, 3 Jun 2016 11:51:28 -0700 Subject: [PATCH 07/56] Eliminate django-secure from requirements and settings files --- {{cookiecutter.project_slug}}/config/settings/common.py | 2 +- {{cookiecutter.project_slug}}/config/settings/production.py | 6 +----- {{cookiecutter.project_slug}}/requirements/base.txt | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index 3668b4274..3e11ee433 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -53,7 +53,7 @@ INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS # MIDDLEWARE CONFIGURATION # ------------------------------------------------------------------------------ MIDDLEWARE_CLASSES = ( - # Make sure djangosecure.middleware.SecurityMiddleware is listed first + 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 80302bee4..43b9b6e32 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -41,9 +41,7 @@ INSTALLED_APPS += ('djangosecure', ) # See https://docs.getsentry.com/hosted/clients/python/integrations/django/ INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) {%- endif %} -SECURITY_MIDDLEWARE = ( - 'djangosecure.middleware.SecurityMiddleware', -) + {% if cookiecutter.use_whitenoise == 'y' -%} # Use Whitenoise to serve static files # See: https://whitenoise.readthedocs.io/ @@ -59,8 +57,6 @@ RAVEN_MIDDLEWARE = ( MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES {%- endif %} -# Make sure djangosecure.middleware.SecurityMiddleware is listed first -MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + MIDDLEWARE_CLASSES {% if cookiecutter.use_opbeat == 'y' -%} # opbeat integration diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index f5e35acd6..67a6fd6b0 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -11,7 +11,6 @@ django==1.9.6 # Configuration django-environ==0.4.0 -django-secure==1.0.1 {% if cookiecutter.use_whitenoise == 'y' -%} whitenoise==3.0 {%- endif %} From 4b6707fe7bebbd849142fe8d75b42a3b5dbcf0ae Mon Sep 17 00:00:00 2001 From: Meghan Heintz Date: Fri, 3 Jun 2016 11:55:44 -0700 Subject: [PATCH 08/56] adding troubleshooting doc --- docs/troubleshooting.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docs/troubleshooting.rst diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst new file mode 100644 index 000000000..fe121b9cd --- /dev/null +++ b/docs/troubleshooting.rst @@ -0,0 +1,9 @@ +Troubleshooting +===================================== + +This page contains some advice about errors and problems commonly encountered during the development of Cookiecutter Django applications. + +#. If you get the error ``jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'.`` , please upgrade your cookiecutter version to >= 1.4 (see issue # 528_ ) +#. ``project_slug`` must be a valid Python module name or you will have issues on imports. + +.. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373 \ No newline at end of file From ecc81134dd552475c52cef749615b1356566811c Mon Sep 17 00:00:00 2001 From: Meghan Heintz Date: Fri, 3 Jun 2016 12:04:11 -0700 Subject: [PATCH 09/56] Adding troubleshotting to index --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index beafb44cf..aa88fe246 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,6 +25,7 @@ Contents: deployment-on-heroku deployment-with-docker faq + troubleshooting Indices and tables ================== From a751fbcf9fa9717dc68db0bb8fad84cb79aac123 Mon Sep 17 00:00:00 2001 From: Meghan Heintz Date: Fri, 3 Jun 2016 12:11:54 -0700 Subject: [PATCH 10/56] moving warnings from readme to troubleshooting --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 14dcf2078..df192efc0 100644 --- a/README.rst +++ b/README.rst @@ -14,9 +14,11 @@ Cookiecutter Django Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. +See Troubleshooting_ for common errors and obstacles. + .. _cookiecutter: https://github.com/audreyr/cookiecutter -**Warning**: if you get the error "jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'." , please upgrade your cookiecutter version to >= 1.4 (see issue # 528_ ) +.. _Troubleshooting: https://cookiecutter-django.readthedocs.io/en/latest/troubleshooting.html .. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373 @@ -99,8 +101,6 @@ You'll be prompted for some values. Provide them, then a Django project will be **Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information. -**Warning**: project_slug must be a valid Python module name or you will have issues on imports. - Answer the prompts with your own desired options_. For example:: Cloning into 'cookiecutter-django'... From 97ddd3da1b626d3815bdc9fac89fc3ccf6da625a Mon Sep 17 00:00:00 2001 From: Vivian Guillen Date: Fri, 3 Jun 2016 12:22:57 -0700 Subject: [PATCH 11/56] Fix navbar right top corner issue --- .../{{cookiecutter.project_slug}}/static/sass/project.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss index bbb2da283..54632b2d6 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss @@ -39,6 +39,10 @@ $red: #b94a48; // This is a fix for the bootstrap4 alpha release +.navbar { + border-radius: 0px; +} + @media (max-width: 47.9em) { .navbar-nav .nav-item { display: inline-block; From 0fa5261f4ad307b6d3c6b67d7144f2f9c48f6e10 Mon Sep 17 00:00:00 2001 From: Leonardo Jimenez Date: Fri, 3 Jun 2016 12:24:11 -0700 Subject: [PATCH 12/56] Include secure defaults for django security middleware --- {{cookiecutter.project_slug}}/config/settings/production.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 43b9b6e32..6a2734315 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -78,9 +78,12 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( SECURE_CONTENT_TYPE_NOSNIFF = env.bool( 'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True) SECURE_BROWSER_XSS_FILTER = True -SESSION_COOKIE_SECURE = False +SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True) +CSRF_COOKIE_SECURE = True +CSRF_COOKIE_HTTPONLY = True +X_FRAME_OPTIONS = 'DENY' # SITE CONFIGURATION # ------------------------------------------------------------------------------ From 54575f02de700c151c2c6bb3dec8adc5d1dcd3c8 Mon Sep 17 00:00:00 2001 From: Jeremy Carbaugh Date: Fri, 3 Jun 2016 12:29:20 -0700 Subject: [PATCH 13/56] Add settings required by SecurityMiddleware also remove django-secure in prod settings --- .../config/settings/production.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 6a2734315..1fc16a537 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -33,9 +33,6 @@ SECRET_KEY = env('DJANGO_SECRET_KEY') # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') -# django-secure -# ------------------------------------------------------------------------------ -INSTALLED_APPS += ('djangosecure', ) {% if cookiecutter.use_sentry == 'y' -%} # raven sentry client # See https://docs.getsentry.com/hosted/clients/python/integrations/django/ @@ -71,6 +68,12 @@ MIDDLEWARE_CLASSES = ( 'opbeat.contrib.django.middleware.OpbeatAPMMiddleware', ) + MIDDLEWARE_CLASSES {%- 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 + # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( @@ -78,11 +81,14 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( SECURE_CONTENT_TYPE_NOSNIFF = env.bool( 'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True) SECURE_BROWSER_XSS_FILTER = True + SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True + SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True) CSRF_COOKIE_SECURE = True CSRF_COOKIE_HTTPONLY = True + X_FRAME_OPTIONS = 'DENY' # SITE CONFIGURATION From 6885547b6ae2bb606ed13eb4a11f9abf6939fa83 Mon Sep 17 00:00:00 2001 From: mjsisley Date: Fri, 3 Jun 2016 12:50:23 -0700 Subject: [PATCH 14/56] Adding documentation for debugging with Docker (#575) * Adding documentation for debugging with Docker * Add -f dev.yml --- docs/developing-locally-docker.rst | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst index 03e9221c5..85aef9c6d 100644 --- a/docs/developing-locally-docker.rst +++ b/docs/developing-locally-docker.rst @@ -141,3 +141,45 @@ If you want to run the stack in detached mode (in the background), use the ``-d` :: $ docker-compose -f dev.yml up -d + +Debugging +~~~~~~~~~~~~~ + +ipdb +""""" + +If you are using the following within your code to debug: + +:: + + import ipdb; ipdb.set_trace() + +Then you may need to run the following for it to work as desired: + +:: + + $ docker-compose run -f dev.yml --service-ports django + +django-debug-toolbar +"""""""""""""""""""" + +In order for django-debug-toolbar to work with docker you need to add your docker-machine ip address (the output of `Get the IP ADDRESS`_) to INTERNAL_IPS in local.py + + +.. May be a better place to put this, as it is not Docker specific. + +You may need to add the following to your css in order for the django-debug-toolbar to be visible (this applies whether Docker is being used or not): + +.. code-block:: css + + /* Override Bootstrap 4 styling on Django Debug Toolbar */ + #djDebug[hidden], #djDebug [hidden] { + display: block !important; + } + + #djDebug [hidden][style='display: none;'] { + display: none !important; + } + + + From 65b3de002c7f31838e8b6d786a54515d08673c82 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 12:52:52 -0700 Subject: [PATCH 15/56] Added @mjsisley to the contributor list --- CHANGELOG.md | 4 ++++ CONTRIBUTORS.rst | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f8491530..1b9bb5e6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +##[2016-06-03] +### Added +- Documentation for debugging with Docker (@mjsisley) + ##[2016-06-02] ### Added - Added better instructions for installing postgres on Mac OS X (@dot2dotseurat ) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4e0bc3bc5..5a0ab6eb4 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -97,6 +97,7 @@ Listed in alphabetical order. Matt Menzenski `@menzenski`_ Matt Warren `@mfwarren`_ Meghan Heintz `@dot2dotseurat`_ + mjsisley `@mjsisley`_ mozillazg `@mozillazg`_ Pablo `@oubiga`_ Raphael Pierzina `@hackebrot`_ @@ -160,6 +161,7 @@ Listed in alphabetical order. .. _@MathijsHoogland: https://github.com/MathijsHoogland .. _@menzenski: https://github.com/menzenski .. _@mfwarren: https://github.com/mfwarren +.. _@mjsisley: https://github.com/mjsisley .. _@mozillazg: https://github.com/mozillazg .. _@originell: https://github.com/originell .. _@oubiga: https://github.com/oubiga From daf98aea428174f7576363b60494a07dcbacc38d Mon Sep 17 00:00:00 2001 From: Meghan Heintz Date: Fri, 3 Jun 2016 14:02:51 -0700 Subject: [PATCH 16/56] Adding Apache 2 License option (#578) * Adding Apache 2 License option * changed order of liences availble --- cookiecutter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index 8fe7010a2..686b8fd61 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -22,5 +22,5 @@ "use_heroku": "n", "use_grunt": "n", "use_angular": "n", - "open_source_license": ["MIT", "BSD", "Not open source"] + "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] } From 1efe3f6caf66351ec6b914ca115865834f4b2f04 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 14:05:08 -0700 Subject: [PATCH 17/56] Tracking more work by @dot2dotseurat --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b9bb5e6e..9657565b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ##[2016-06-03] ### Added - Documentation for debugging with Docker (@mjsisley) +- Apache 2 License option in `cookiecutter.json` (@dot2dotseurat) ##[2016-06-02] ### Added From 36ac82b1cfbeedbdbcb081c9fe340a7a5f057e3f Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 14:07:25 -0700 Subject: [PATCH 18/56] Removed angular2 --- README.rst | 1 - cookiecutter.json | 1 - .../{{cookiecutter.project_slug}}/templates/base.html | 6 +----- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/README.rst b/README.rst index df192efc0..3e906217f 100644 --- a/README.rst +++ b/README.rst @@ -131,7 +131,6 @@ Answer the prompts with your own desired options_. For example:: use_docker [y]: y use_heroku [n]: n use_grunt [n]: y - use_angular [n]: n Select open_source_license: 1 - MIT 2 - BSD diff --git a/cookiecutter.json b/cookiecutter.json index 686b8fd61..36aa3c300 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -21,6 +21,5 @@ "use_docker": "y", "use_heroku": "n", "use_grunt": "n", - "use_angular": "n", "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] } diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html index b54692228..a1e2a5ace 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html @@ -1,5 +1,5 @@ {% raw %}{% load staticfiles i18n %} - + @@ -23,10 +23,6 @@ {% endblock %} - {% endraw %}{% if cookiecutter.use_angular == "y" %}{% raw %}{% block angular %} - - {% endblock %}{% endraw %}{% endif %}{% raw %} - From ed11e05d09a56e8326e7c2dcaec7331bbfec6400 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 14:08:25 -0700 Subject: [PATCH 19/56] Finish removing Angular --- CHANGELOG.md | 3 +++ README.rst | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9657565b4..088fb47a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Documentation for debugging with Docker (@mjsisley) - Apache 2 License option in `cookiecutter.json` (@dot2dotseurat) +### Deleted +- AngularJS (@pydanny) + ##[2016-06-02] ### Added - Added better instructions for installing postgres on Mac OS X (@dot2dotseurat ) diff --git a/README.rst b/README.rst index 3e906217f..23fb79d64 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,6 @@ Features * For Django 1.9 * Renders Django projects with 100% starting test coverage * Twitter Bootstrap_ v4.0.0 - alpha_ -* AngularJS_ * 12-Factor_ based settings via django-environ_ * Optimized development and production settings * Registration via django-allauth_ @@ -57,7 +56,6 @@ Optional Integrations .. _alpha: http://blog.getbootstrap.com/2015/08/19/bootstrap-4-alpha/ .. _Bootstrap: https://github.com/twbs/bootstrap -.. _AngularJS: https://github.com/angular/angular.js .. _django-environ: https://github.com/joke2k/django-environ .. _12-Factor: http://12factor.net/ .. _django-allauth: https://github.com/pennersr/django-allauth From 7610a7978a20ade7fecbc39ce01b2d2823598b55 Mon Sep 17 00:00:00 2001 From: Vivian Guillen Date: Fri, 3 Jun 2016 15:04:04 -0700 Subject: [PATCH 20/56] Add gulp with autoprefixing and minification for sass --- {{cookiecutter.project_slug}}/gulpfile.js | 52 ++++++++++++++++++++++ {{cookiecutter.project_slug}}/package.json | 34 +++++++++----- 2 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/gulpfile.js diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js new file mode 100644 index 000000000..6dddcf29c --- /dev/null +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -0,0 +1,52 @@ + +//////////////////////////////// + //Setup// +//////////////////////////////// + +// Plugins +var gulp = require('gulp'), + pjson = require('./package.json'), + gutil = require('gulp-util'), + sass = require('gulp-sass'), + autoprefixer = require('gulp-autoprefixer'), + cssnano = require('gulp-cssnano'), + rename = require('gulp-rename'), + del = require('del'), + plumber = require('gulp-plumber'), + pixrem = require('gulp-pixrem'), + browserSync = require('browser-sync'); + + +// Relative paths function +var pathsConfig = function (appName) { + this.app = "./" + (appName || pjson.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', + } +}; + +var paths = pathsConfig(); + +//////////////////////////////// + //Tasks// +//////////////////////////////// + +// Styles +gulp.task('styles', function() { + return gulp.src(paths.sass + '/project.scss', { style: 'expanded' }) + .pipe(sass().on('error', sass.logError)) + .pipe(plumber()) // It checks for errors + .pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes + .pipe(pixrem()) // add fallbacks for rem units + .pipe(gulp.dest('./static/css/')) + .pipe(rename({ suffix: '.min' })) + .pipe(cssnano()) // Minifies the result + .pipe(gulp.dest('./static/css/')); +}); diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index 47cf69441..5c8b82d2b 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -1,19 +1,29 @@ { - "name": "{{cookiecutter.project_slug}}", - "version": "{{ cookiecutter.version }}", + "name": "testing", + "version": "0.1.0", "dependencies": {}, "devDependencies": { - "grunt": "~0.4.5", - "grunt-contrib-watch": "~0.6.1", - "grunt-bg-shell": "~2.3.1", - "connect-livereload": "~0.3.2", - "time-grunt": "~1.2.1", - "load-grunt-tasks": "~3.2.0", - "grunt-sass": "~1.0.0", - "grunt-postcss": "~0.5.5", - "cssnano": "~2.1.0", "autoprefixer-core": "~5.2.1", - "pixrem": "~1.3.1" + "browser-sync": "^2.12.10", + "connect-livereload": "~0.3.2", + "cssnano": "~2.1.0", + "del": "^2.2.0", + "grunt": "~0.4.5", + "grunt-bg-shell": "~2.3.1", + "grunt-contrib-watch": "~0.6.1", + "grunt-postcss": "~0.5.5", + "grunt-sass": "~1.0.0", + "gulp": "^3.9.1", + "gulp-autoprefixer": "^3.1.0", + "gulp-cssnano": "^2.1.2", + "gulp-pixrem": "^1.0.0", + "gulp-plumber": "^1.1.0", + "gulp-rename": "^1.2.2", + "gulp-sass": "^2.3.1", + "gulp-util": "^3.0.7", + "load-grunt-tasks": "~3.2.0", + "pixrem": "~1.3.1", + "time-grunt": "~1.2.1" }, "engines": { "node": ">=0.8.0" From ffc83080c77ff866cf2c9e868d2100bd13890406 Mon Sep 17 00:00:00 2001 From: Emily C Date: Fri, 3 Jun 2016 15:23:00 -0700 Subject: [PATCH 21/56] initial commit --- docs/index.rst | 2 +- docs/my-favorite-cookie.rst | 100 ++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 docs/my-favorite-cookie.rst diff --git a/docs/index.rst b/docs/index.rst index aa88fe246..b7b3885db 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,7 +14,7 @@ Contents: .. toctree:: :maxdepth: 2 - + my-favorite-cookie project-generation-options developing-locally developing-locally-docker diff --git a/docs/my-favorite-cookie.rst b/docs/my-favorite-cookie.rst new file mode 100644 index 000000000..a65833526 --- /dev/null +++ b/docs/my-favorite-cookie.rst @@ -0,0 +1,100 @@ +************************************************ +Creating your first app with Cookiecutter-Django +************************************************ + +This tutorial will show you how to build a simple app using the `Cookiecutter Django `_ templating system. We'll be building a cookie polling app to determine the most popular flavor of cookie. + +Developers who have never used Django will learn the basics of creating a Django app; developers who are experienced with Django will learn how to set up a project within the Cookiecutter system. While many Django tutorials use the default SQLite database, Cookiecutter Django uses PostGres only, so we'll have you install and use that. + + +Dependencies +============ +This tutorial was written on Windows 10 using `git bash `_; alternate instructions for Mac OS and Linux will be provided when needed. Any Linux-style shell should work for the following commands. + +You should have your preferred versions of `Python `_ +and `Django `_ installed. Use the latest stable versions if you have no preference. + +You should have `Virtualenv `_ and `Cookiecutter `_ installed: + +.. code-block:: python + + $ pip install virtualenv + $ pip install cookiecutter + +You should also have `PostgreSQL `_ installed on your machine--just download and run the installer for your OS. The install menu will prompt you for a password, which you'll use when creating the project's database. + + +Instructions +============ + +1. **Setup** -- how to set up a virtual environment +2. **Cookiecutter** -- use Cookiecutter to initialize a project with your own customized information. +3. **Building the App** -- creating the My Favorite Cookie application. + +============ +1. Setup +============ + +Virtual Environment +""""""""""""""""""" + +Create a virtual environment for your project. Cookiecutter will install a bunch of dependencies for you automatically; using a virtualenv will prevent this from interfering with your other work. + +.. code-block:: python + + $ virtualenv c:/.virtualenvs/cookie_polls + +Replace ``c:/.virtualenvs`` with the path to your own ``.virtualenvs`` folder. + +Activate the virtual environment by calling ``source`` on the ``activate`` shell script . On Windows you'll call this from the virtualenv's ``scripts`` folder: + +.. code-block:: python + + $ source /path/to/.virtualenvs/cookie_polls/scripts/activate + +On other operating systems, it'll be found in the ``bin`` folder. + +.. code-block:: python + + $ source /path/to/.virtualenvs/cookie_polls/bin/activate + +You'll know the virtual environment is active because its name will appear in parentheses before the command prompt. When you're done with this project, you can leave the virtual environment with the ``deactivate`` command. + +.. code-block:: python + + (cookie_polls) + $ deactivate + + +Now you're ready to create your project using Cookiecutter. + + +=============== +2. Cookiecutter +=============== + +Django developers may be familiar with the ``startproject`` command, which initializes the directory structure and required files for a bare-bones Django project. While this is fine when you're just learning Django for the first time, it's not great for a real production app. Cookiecutter takes care of a lot of standard tasks for you, including installing software dependencies, setting up testing files, and including and organizing common libraries like Bootstrap and AngularJS. It also generates a software license and a README. + +Change directories into the folder where you want your project to live, and run ``cookiecutter`` followed by the URL of Cookiecutter's Github repo. + +.. code-block:: python + + $ cd /my/project/folder + (cookie_polls) + my/project/folder + $ cookiecutter https://github.com/pydanny/cookiecutter-django + +This will prompt you for a bunch of values specific to your project. Press "enter" without typing anything to use the default values, which are shown in [brackets] after the question. You can learn about all the different options `here, `_ but for now we'll use the defaults for everything but your name, your email, the project's name, and the project's description. + +.. code-block:: python + + project_name [project_name]: My Favorite Cookie + project_slug [My_Favorite_Cookie]: + author_name [Your Name]: Emily Cain + email [Your email]: contact@emcain.net + description [A short description of the project.]: Poll your friends to determine the most popular cookie. + +Then hit "enter" to use the default values for everything else. + + + From 87845bd81700d75b983ed7322f016e064ed6fa8f Mon Sep 17 00:00:00 2001 From: Audrey Roy Greenfeld Date: Fri, 3 Jun 2016 15:31:50 -0700 Subject: [PATCH 22/56] Temp quick fixes to improve developing-locally doc --- docs/developing-locally.rst | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/developing-locally.rst b/docs/developing-locally.rst index 119856909..a7f0269f3 100644 --- a/docs/developing-locally.rst +++ b/docs/developing-locally.rst @@ -9,20 +9,32 @@ The steps below will get you up and running with a local development environment * virtualenv * PostgreSQL -First make sure to create and activate a virtualenv_, then open a terminal at the project root and install the os dependencies:: +First make sure to create and activate a virtualenv_. - $ sudo ./install_os_dependencies.sh install +.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/ Then install the requirements for your local development:: $ pip install -r requirements/local.txt -.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/ - Then, create a PostgreSQL database with the following command, where `[project_slug]` is what value you entered for your project's `project_slug`:: $ createdb [project_slug] +You can now run the usual Django ``migrate`` and ``runserver`` commands:: + + $ python manage.py migrate + $ python manage.py runserver + +At this point you can take a break from setup and start getting to know the files in the project. + +But if you want to go further with setup, read on. + +(Note: the following sections still need to be revised) + +Setting Up Env Vars for Production +----------------------------------- + `Cookiecutter Django` uses the excellent `django-environ`_ package with its ``DATABASE_URL`` environment variable to simplify database configuration in your Django settings. Now all you have to do is rename env.example to .env and then compose a definition for ``DATABASE_URL`` as shown below and add it to the .env file: .. parsed-literal:: @@ -31,12 +43,8 @@ Then, create a PostgreSQL database with the following command, where `[project_s .. _django-environ: http://django-environ.readthedocs.io -You can now run the usual Django ``migrate`` and ``runserver`` commands:: - - $ python manage.py migrate - $ python manage.py runserver - -**Setup your email backend** +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`_ @@ -85,5 +93,3 @@ The base app will now run as it would with the usual ``manage.py runserver`` but To get live reloading to work you'll probably need to install an `appropriate browser extension`_ .. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions- - -It's time to write the code!!! From a7eb85208d1908276fe91960a4d2b558d60bd577 Mon Sep 17 00:00:00 2001 From: Leonardo Jimenez Date: Fri, 3 Jun 2016 13:22:52 -0700 Subject: [PATCH 23/56] Eliminate empty spaces generated on Jinja on config/settings/production.py --- .../config/settings/production.py | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 1fc16a537..346bf7cb6 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -29,33 +29,26 @@ from .common import * # noqa # Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ SECRET_KEY = env('DJANGO_SECRET_KEY') + # This ensures that Django will be able to detect a secure connection # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') - -{% if cookiecutter.use_sentry == 'y' -%} +{%- if cookiecutter.use_sentry == 'y'-%} # raven sentry client # See https://docs.getsentry.com/hosted/clients/python/integrations/django/ INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) -{%- endif %} - -{% if cookiecutter.use_whitenoise == 'y' -%} +{% 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_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES -{%- endif %} -{% if cookiecutter.use_sentry == 'y' -%} -RAVEN_MIDDLEWARE = ( - 'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', -) +{% endif %} +{%- if cookiecutter.use_sentry == 'y' -%} +RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', ) MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES -{%- endif %} - - -{% if cookiecutter.use_opbeat == 'y' -%} +{% endif %} +{%- if cookiecutter.use_opbeat == 'y' -%} # opbeat integration # See https://opbeat.com/languages/django/ INSTALLED_APPS += ('opbeat.contrib.django',) @@ -67,7 +60,7 @@ OPBEAT = { MIDDLEWARE_CLASSES = ( 'opbeat.contrib.django.middleware.OpbeatAPMMiddleware', ) + MIDDLEWARE_CLASSES -{%- endif %} +{% endif %} # SECURITY CONFIGURATION # ------------------------------------------------------------------------------ @@ -81,14 +74,11 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( SECURE_CONTENT_TYPE_NOSNIFF = env.bool( 'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True) SECURE_BROWSER_XSS_FILTER = True - SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True - SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True) CSRF_COOKIE_SECURE = True CSRF_COOKIE_HTTPONLY = True - X_FRAME_OPTIONS = 'DENY' # SITE CONFIGURATION @@ -100,6 +90,7 @@ ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain INSTALLED_APPS += ('gunicorn', ) + # STORAGE CONFIGURATION # ------------------------------------------------------------------------------ # Uploaded Media Files From 907b8ecfbda0e54b1cf535476b7127434db8585a Mon Sep 17 00:00:00 2001 From: Leonardo Date: Fri, 3 Jun 2016 16:07:27 -0700 Subject: [PATCH 24/56] Remove django-secure (#579) * Eliminate django-secure from requirements and settings files * Include secure defaults for django security middleware * Add settings required by SecurityMiddleware also remove django-secure in prod settings * Eliminate empty spaces generated on Jinja on config/settings/production.py --- .../config/settings/common.py | 2 +- .../config/settings/production.py | 48 +++++++++---------- .../requirements/base.txt | 1 - 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index 3668b4274..3e11ee433 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -53,7 +53,7 @@ INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS # MIDDLEWARE CONFIGURATION # ------------------------------------------------------------------------------ MIDDLEWARE_CLASSES = ( - # Make sure djangosecure.middleware.SecurityMiddleware is listed first + 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 80302bee4..346bf7cb6 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -29,40 +29,26 @@ from .common import * # noqa # Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ SECRET_KEY = env('DJANGO_SECRET_KEY') + # This ensures that Django will be able to detect a secure connection # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') - -# django-secure -# ------------------------------------------------------------------------------ -INSTALLED_APPS += ('djangosecure', ) -{% if cookiecutter.use_sentry == 'y' -%} +{%- if cookiecutter.use_sentry == 'y'-%} # raven sentry client # See https://docs.getsentry.com/hosted/clients/python/integrations/django/ INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) -{%- endif %} -SECURITY_MIDDLEWARE = ( - 'djangosecure.middleware.SecurityMiddleware', -) -{% if cookiecutter.use_whitenoise == 'y' -%} +{% 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_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES -{%- endif %} -{% if cookiecutter.use_sentry == 'y' -%} -RAVEN_MIDDLEWARE = ( - 'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', -) +{% endif %} +{%- if cookiecutter.use_sentry == 'y' -%} +RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', ) MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES -{%- endif %} - -# Make sure djangosecure.middleware.SecurityMiddleware is listed first -MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + MIDDLEWARE_CLASSES - -{% if cookiecutter.use_opbeat == 'y' -%} +{% endif %} +{%- if cookiecutter.use_opbeat == 'y' -%} # opbeat integration # See https://opbeat.com/languages/django/ INSTALLED_APPS += ('opbeat.contrib.django',) @@ -74,7 +60,13 @@ OPBEAT = { MIDDLEWARE_CLASSES = ( 'opbeat.contrib.django.middleware.OpbeatAPMMiddleware', ) + MIDDLEWARE_CLASSES -{%- endif %} +{% 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 + # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( @@ -82,9 +74,12 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( SECURE_CONTENT_TYPE_NOSNIFF = env.bool( 'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True) SECURE_BROWSER_XSS_FILTER = True -SESSION_COOKIE_SECURE = False +SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True) +CSRF_COOKIE_SECURE = True +CSRF_COOKIE_HTTPONLY = True +X_FRAME_OPTIONS = 'DENY' # SITE CONFIGURATION # ------------------------------------------------------------------------------ @@ -95,6 +90,7 @@ ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain INSTALLED_APPS += ('gunicorn', ) + # STORAGE CONFIGURATION # ------------------------------------------------------------------------------ # Uploaded Media Files diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index f5e35acd6..67a6fd6b0 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -11,7 +11,6 @@ django==1.9.6 # Configuration django-environ==0.4.0 -django-secure==1.0.1 {% if cookiecutter.use_whitenoise == 'y' -%} whitenoise==3.0 {%- endif %} From c64027a5cfbe94d7056edb27723433f45bff7dee Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 16:09:55 -0700 Subject: [PATCH 25/56] Add @xpostudio4 as a contributor --- CHANGELOG.md | 1 + CONTRIBUTORS.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 088fb47a8..3038b6f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Deleted - AngularJS (@pydanny) +- django-secure (@xpostudio4) ##[2016-06-02] ### Added diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 5a0ab6eb4..99239b71d 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -87,6 +87,7 @@ Listed in alphabetical order. Kevin Ndung'u `@kevgathuku`_ Krzysztof Szumny `@noisy`_ Krzysztof Żuraw `@krzysztofzuraw`_ + Leonardo Jimenez `@xpostudio4`_ Lin Xianyi `@iynaix`_ Luis Nell `@originell`_ Lukas Klein @@ -152,6 +153,7 @@ Listed in alphabetical order. .. _@ikkebr: https://github.com/ikkebr .. _@iynaix: https://github.com/iynaix .. _@jazztpt: https://github.com/jazztpt +.. _@xpostudio4: https://github.com/xpostudio4 .. _@juliocc: https://github.com/juliocc .. _@jvanbrug: https://github.com/jvanbrug .. _@ka7eh: https://github.com/ka7eh From fa89445f6668c7668937c3f6b1d93f10ef557206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sul=C3=A9?= Date: Fri, 3 Jun 2016 16:35:10 -0700 Subject: [PATCH 26/56] Removing unnecessary version check #534 (#584) * Address issue #534 * missing comma added * remove unecesssary version check #534 --- cookiecutter.json | 3 ++- hooks/pre_gen_project.py | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 36aa3c300..65879a69e 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -21,5 +21,6 @@ "use_docker": "y", "use_heroku": "n", "use_grunt": "n", - "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] + "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"], + "_cookiecutter_version": "Minimum cookiecutter version" } diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 3dfc190a2..9cd168bce 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,8 +1,6 @@ -import cookiecutter - project_slug = '{{ cookiecutter.project_slug }}' if hasattr(project_slug, 'isidentifier'): assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!' -assert cookiecutter.__version__ > '1.3.0', 'Please upgrade your Cookiecutter installation' + From 700ee39be81dd5c0bf529a285ae75c79dd0fbba4 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 16:49:04 -0700 Subject: [PATCH 27/56] Added @suledev to contributors list --- CHANGELOG.md | 1 + CONTRIBUTORS.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3038b6f5e..f6362f495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Documentation for debugging with Docker (@mjsisley) - Apache 2 License option in `cookiecutter.json` (@dot2dotseurat) +- Removed unnecessary version check from `pre_gen_project.py` (@suledev) ### Deleted - AngularJS (@pydanny) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 99239b71d..0f559e00b 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -109,6 +109,7 @@ Listed in alphabetical order. stepmr `@stepmr`_ Sławek Ehlert `@slafs`_ Srinivas Nyayapati `@shireenrao`_ + Sule Marshall `@suledev`_ Taylor Baldwin Théo Segonds `@show0k`_ Tom Atkins `@knitatoms`_ @@ -174,6 +175,7 @@ Listed in alphabetical order. .. _@shireenrao: https://github.com/shireenrao .. _@slafs: https://github.com/slafs .. _@stepmr: https://github.com/stepmr +.. _@suledev: https://github.com/suledev .. _@Travistock: https://github.com/Tavistock .. _@trungdong: https://github.com/trungdong .. _@yunti: https://github.com/yunti From 8a925db024b114930eacd3caa1509496516183a3 Mon Sep 17 00:00:00 2001 From: Vivian Guillen Date: Fri, 3 Jun 2016 17:05:57 -0700 Subject: [PATCH 28/56] Add gulp alternative as a js task runner --- cookiecutter.json | 2 +- hooks/post_gen_project.py | 38 ++++++++++--- {{cookiecutter.project_slug}}/gulpfile.js | 65 ++++++++++++++++++++-- {{cookiecutter.project_slug}}/package.json | 21 ++++--- 4 files changed, 106 insertions(+), 20 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 8fe7010a2..0536bfc9f 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -20,7 +20,7 @@ "use_python2": "n", "use_docker": "y", "use_heroku": "n", - "use_grunt": "n", + "js_task_runner": ["Gulp", "Grunt", "None"], "use_angular": "n", "open_source_license": ["MIT", "BSD", "Not open source"] } diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index cffb052e8..72abbfcad 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -134,7 +134,25 @@ def remove_grunt_files(): """ Removes files needed for grunt if it isn't going to be used """ - for filename in ["Gruntfile.js", "package.json"]: + for filename in ["Gruntfile.js"]: + os.remove(os.path.join( + PROJECT_DIRECTORY, filename + )) + +def remove_gulp_files(): + """ + Removes files needed for grunt if it isn't going to be used + """ + for filename in ["gulpfile.js"]: + os.remove(os.path.join( + PROJECT_DIRECTORY, filename + )) + +def remove_packageJSON_file(): + """ + Removes files needed for grunt if it isn't going to be used + """ + for filename in ["package.json"]: os.remove(os.path.join( PROJECT_DIRECTORY, filename )) @@ -176,18 +194,24 @@ if '{{ cookiecutter.use_heroku }}'.lower() != 'y': if '{{ cookiecutter.use_docker }}'.lower() != 'y': remove_docker_files() -# 6. Removes all grunt files if it isn't going to be used -if '{{ cookiecutter.use_grunt }}'.lower() != 'y': +# 6. Removes all JS task manager files if it isn't going to be used +if '{{ cookiecutter.js_task_runner}}'.lower() == 'gulp': remove_grunt_files() +elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt': + remove_gulp_files() +else: + remove_gulp_files() + remove_grunt_files() + remove_packageJSON_file() -# 7. Display a warning if use_docker and use_grunt are selected. Grunt isn't supported by our +# 7. Display a warning if use_docker and js task runner are selected. Grunt isn't supported by our # docker config atm. -if '{{ cookiecutter.use_grunt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': +if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( - "You selected to use docker and grunt. This is NOT supported out of the box for now. You " + "You selected to use docker and a JS task runner. This is NOT supported out of the box for now. You " "can continue to use the project like you normally would, but you will need to add a " - " grunt service to your docker configuration manually." + "js task runner service to your docker configuration manually." ) # 7. Display a warning if use_docker and use_mailhog are selected. Mailhog isn't supported by our diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js index 6dddcf29c..e5b0df9dc 100644 --- a/{{cookiecutter.project_slug}}/gulpfile.js +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -14,6 +14,10 @@ var gulp = require('gulp'), del = require('del'), plumber = require('gulp-plumber'), pixrem = require('gulp-pixrem'), + uglify = require('gulp-uglify'), + imagemin = require('gulp-imagemin'), + exec = require('gulp-exec'), + runSequence = require('run-sequence'), browserSync = require('browser-sync'); @@ -38,15 +42,66 @@ var paths = pathsConfig(); //Tasks// //////////////////////////////// -// Styles +// Styles autoprefixing and minification gulp.task('styles', function() { - return gulp.src(paths.sass + '/project.scss', { style: 'expanded' }) + return gulp.src(paths.sass + '/project.scss') .pipe(sass().on('error', sass.logError)) - .pipe(plumber()) // It checks for errors + .pipe(plumber()) // Checks for errors .pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes .pipe(pixrem()) // add fallbacks for rem units - .pipe(gulp.dest('./static/css/')) + .pipe(gulp.dest(paths.css)) .pipe(rename({ suffix: '.min' })) .pipe(cssnano()) // Minifies the result - .pipe(gulp.dest('./static/css/')); + .pipe(gulp.dest(paths.css)); +}); + +// Javascript minification +gulp.task('scripts', function() { + return gulp.src(paths.js + '/project.js') + .pipe(plumber()) // Checks for errors + .pipe(uglify()) // Minifies the js + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest(paths.js)); +}); + +// Image compression +gulp.task('imgCompression', function(){ + return gulp.src(paths.images + '/*') + .pipe(imagemin()) // Compresses PNG, JPEG, GIF and SVG images + .pipe(gulp.dest(paths.images)) +}); + +// Run django server +gulp.task('runServer', function() { + exec('python manage.py runserver', function (err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + }); +}); + +// Browser sync server for live reload +gulp.task('browserSync', function() { + browserSync.init( + [paths.css + "/*.css", paths.js + "*.js", paths.templates + '*.html'], { + proxy: "localhost:8000" + }); +}); + +// Default task +gulp.task('default', function() { + runSequence(['styles', 'scripts', 'imgCompression'], 'runServer', 'browserSync'); +}); + +//////////////////////////////// + //Watch// +//////////////////////////////// + +// Watch +gulp.task('watch', ['default'], function() { + + gulp.watch(paths.sass + '/*.scss', ['styles']); + gulp.watch(paths.js + '/*.js', ['scripts']); + gulp.watch(paths.images + '/*', ['imgCompression']); + gulp.watch('templates/*.html'); + }); diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index 5c8b82d2b..2be4b50c8 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -1,29 +1,36 @@ { - "name": "testing", - "version": "0.1.0", + "name": "{{cookiecutter.project_slug}}", + "version": "{{ cookiecutter.version }}", "dependencies": {}, "devDependencies": { + {% if cookiecutter.js_task_runner == 'Grunt' %} "autoprefixer-core": "~5.2.1", - "browser-sync": "^2.12.10", "connect-livereload": "~0.3.2", "cssnano": "~2.1.0", - "del": "^2.2.0", "grunt": "~0.4.5", "grunt-bg-shell": "~2.3.1", "grunt-contrib-watch": "~0.6.1", "grunt-postcss": "~0.5.5", "grunt-sass": "~1.0.0", + "load-grunt-tasks": "~3.2.0", + "pixrem": "~1.3.1", + "time-grunt": "~1.2.1" + {% elif cookiecutter.js_task_runner == 'Gulp' %} + "browser-sync": "^2.12.10", + "del": "^2.2.0", "gulp": "^3.9.1", "gulp-autoprefixer": "^3.1.0", "gulp-cssnano": "^2.1.2", + "gulp-exec": "^2.1.2", + "gulp-imagemin": "^3.0.1", "gulp-pixrem": "^1.0.0", "gulp-plumber": "^1.1.0", "gulp-rename": "^1.2.2", "gulp-sass": "^2.3.1", + "gulp-uglify": "^1.5.3", "gulp-util": "^3.0.7", - "load-grunt-tasks": "~3.2.0", - "pixrem": "~1.3.1", - "time-grunt": "~1.2.1" + "run-sequence": "^1.2.1" + {% endif %} }, "engines": { "node": ">=0.8.0" From 60bfc7afa167a133eeb42d75dc1081efbde9fdf7 Mon Sep 17 00:00:00 2001 From: mjsisley Date: Fri, 3 Jun 2016 17:07:07 -0700 Subject: [PATCH 29/56] remove typo /start.sh --- {{cookiecutter.project_slug}}/compose/nginx/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile index addd333ed..7bb605584 100644 --- a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile @@ -5,5 +5,4 @@ ADD nginx.conf /etc/nginx/nginx.conf ADD start.sh /start.sh ADD nginx-secure.conf /etc/nginx/nginx-secure.conf ADD dhparams.pem /etc/ssl/private/dhparams.pem -ADD /start.sh {% endif %} From cda3cfc641d0ab66f4b4f86acc8cfc5747341824 Mon Sep 17 00:00:00 2001 From: Vivian Guillen Date: Fri, 3 Jun 2016 17:31:36 -0700 Subject: [PATCH 30/56] merge in @@viviangb #585 --- cookiecutter.json | 5 +- hooks/post_gen_project.py | 38 +++++-- {{cookiecutter.project_slug}}/gulpfile.js | 107 ++++++++++++++++++ {{cookiecutter.project_slug}}/package.json | 37 ++++-- .../static/sass/project.scss | 21 ++++ 5 files changed, 188 insertions(+), 20 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/gulpfile.js diff --git a/cookiecutter.json b/cookiecutter.json index 65879a69e..fb01784ab 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -20,7 +20,6 @@ "use_python2": "n", "use_docker": "y", "use_heroku": "n", - "use_grunt": "n", - "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"], - "_cookiecutter_version": "Minimum cookiecutter version" + "js_task_runner": ["Gulp", "Grunt", "None"], + "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] } diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index cffb052e8..72abbfcad 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -134,7 +134,25 @@ def remove_grunt_files(): """ Removes files needed for grunt if it isn't going to be used """ - for filename in ["Gruntfile.js", "package.json"]: + for filename in ["Gruntfile.js"]: + os.remove(os.path.join( + PROJECT_DIRECTORY, filename + )) + +def remove_gulp_files(): + """ + Removes files needed for grunt if it isn't going to be used + """ + for filename in ["gulpfile.js"]: + os.remove(os.path.join( + PROJECT_DIRECTORY, filename + )) + +def remove_packageJSON_file(): + """ + Removes files needed for grunt if it isn't going to be used + """ + for filename in ["package.json"]: os.remove(os.path.join( PROJECT_DIRECTORY, filename )) @@ -176,18 +194,24 @@ if '{{ cookiecutter.use_heroku }}'.lower() != 'y': if '{{ cookiecutter.use_docker }}'.lower() != 'y': remove_docker_files() -# 6. Removes all grunt files if it isn't going to be used -if '{{ cookiecutter.use_grunt }}'.lower() != 'y': +# 6. Removes all JS task manager files if it isn't going to be used +if '{{ cookiecutter.js_task_runner}}'.lower() == 'gulp': remove_grunt_files() +elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt': + remove_gulp_files() +else: + remove_gulp_files() + remove_grunt_files() + remove_packageJSON_file() -# 7. Display a warning if use_docker and use_grunt are selected. Grunt isn't supported by our +# 7. Display a warning if use_docker and js task runner are selected. Grunt isn't supported by our # docker config atm. -if '{{ cookiecutter.use_grunt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': +if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( - "You selected to use docker and grunt. This is NOT supported out of the box for now. You " + "You selected to use docker and a JS task runner. This is NOT supported out of the box for now. You " "can continue to use the project like you normally would, but you will need to add a " - " grunt service to your docker configuration manually." + "js task runner service to your docker configuration manually." ) # 7. Display a warning if use_docker and use_mailhog are selected. Mailhog isn't supported by our diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js new file mode 100644 index 000000000..e5b0df9dc --- /dev/null +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -0,0 +1,107 @@ + +//////////////////////////////// + //Setup// +//////////////////////////////// + +// Plugins +var gulp = require('gulp'), + pjson = require('./package.json'), + gutil = require('gulp-util'), + sass = require('gulp-sass'), + autoprefixer = require('gulp-autoprefixer'), + cssnano = require('gulp-cssnano'), + rename = require('gulp-rename'), + del = require('del'), + plumber = require('gulp-plumber'), + pixrem = require('gulp-pixrem'), + uglify = require('gulp-uglify'), + imagemin = require('gulp-imagemin'), + exec = require('gulp-exec'), + runSequence = require('run-sequence'), + browserSync = require('browser-sync'); + + +// Relative paths function +var pathsConfig = function (appName) { + this.app = "./" + (appName || pjson.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', + } +}; + +var paths = pathsConfig(); + +//////////////////////////////// + //Tasks// +//////////////////////////////// + +// Styles autoprefixing and minification +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(pixrem()) // add fallbacks for rem units + .pipe(gulp.dest(paths.css)) + .pipe(rename({ suffix: '.min' })) + .pipe(cssnano()) // Minifies the result + .pipe(gulp.dest(paths.css)); +}); + +// Javascript minification +gulp.task('scripts', function() { + return gulp.src(paths.js + '/project.js') + .pipe(plumber()) // Checks for errors + .pipe(uglify()) // Minifies the js + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest(paths.js)); +}); + +// Image compression +gulp.task('imgCompression', function(){ + return gulp.src(paths.images + '/*') + .pipe(imagemin()) // Compresses PNG, JPEG, GIF and SVG images + .pipe(gulp.dest(paths.images)) +}); + +// Run django server +gulp.task('runServer', function() { + exec('python manage.py runserver', function (err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + }); +}); + +// Browser sync server for live reload +gulp.task('browserSync', function() { + browserSync.init( + [paths.css + "/*.css", paths.js + "*.js", paths.templates + '*.html'], { + proxy: "localhost:8000" + }); +}); + +// Default task +gulp.task('default', function() { + runSequence(['styles', 'scripts', 'imgCompression'], 'runServer', 'browserSync'); +}); + +//////////////////////////////// + //Watch// +//////////////////////////////// + +// Watch +gulp.task('watch', ['default'], function() { + + gulp.watch(paths.sass + '/*.scss', ['styles']); + gulp.watch(paths.js + '/*.js', ['scripts']); + gulp.watch(paths.images + '/*', ['imgCompression']); + gulp.watch('templates/*.html'); + +}); diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index 47cf69441..2be4b50c8 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -3,17 +3,34 @@ "version": "{{ cookiecutter.version }}", "dependencies": {}, "devDependencies": { - "grunt": "~0.4.5", - "grunt-contrib-watch": "~0.6.1", - "grunt-bg-shell": "~2.3.1", - "connect-livereload": "~0.3.2", - "time-grunt": "~1.2.1", - "load-grunt-tasks": "~3.2.0", - "grunt-sass": "~1.0.0", - "grunt-postcss": "~0.5.5", - "cssnano": "~2.1.0", + {% if cookiecutter.js_task_runner == 'Grunt' %} "autoprefixer-core": "~5.2.1", - "pixrem": "~1.3.1" + "connect-livereload": "~0.3.2", + "cssnano": "~2.1.0", + "grunt": "~0.4.5", + "grunt-bg-shell": "~2.3.1", + "grunt-contrib-watch": "~0.6.1", + "grunt-postcss": "~0.5.5", + "grunt-sass": "~1.0.0", + "load-grunt-tasks": "~3.2.0", + "pixrem": "~1.3.1", + "time-grunt": "~1.2.1" + {% elif cookiecutter.js_task_runner == 'Gulp' %} + "browser-sync": "^2.12.10", + "del": "^2.2.0", + "gulp": "^3.9.1", + "gulp-autoprefixer": "^3.1.0", + "gulp-cssnano": "^2.1.2", + "gulp-exec": "^2.1.2", + "gulp-imagemin": "^3.0.1", + "gulp-pixrem": "^1.0.0", + "gulp-plumber": "^1.1.0", + "gulp-rename": "^1.2.2", + "gulp-sass": "^2.3.1", + "gulp-uglify": "^1.5.3", + "gulp-util": "^3.0.7", + "run-sequence": "^1.2.1" + {% endif %} }, "engines": { "node": ">=0.8.0" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss index e737d593f..54632b2d6 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss @@ -1,5 +1,10 @@ + // project specific CSS goes here +//////////////////////////////// + //Variables// +//////////////////////////////// + // Alert colors $white: #fff; @@ -9,6 +14,10 @@ $pink: #f2dede; $dark-pink: #eed3d7; $red: #b94a48; +//////////////////////////////// + //Alerts// +//////////////////////////////// + // bootstrap alert CSS, translated to the django-standard levels of // debug, info, success, warning, error @@ -24,8 +33,16 @@ $red: #b94a48; color: $red; } +//////////////////////////////// + //Navbar// +//////////////////////////////// + // This is a fix for the bootstrap4 alpha release +.navbar { + border-radius: 0px; +} + @media (max-width: 47.9em) { .navbar-nav .nav-item { display: inline-block; @@ -42,6 +59,10 @@ $red: #b94a48; } } +//////////////////////////////// + //Django Toolbar// +//////////////////////////////// + // Display django-debug-toolbar. // See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742 // and https://github.com/pydanny/cookiecutter-django/issues/317 From 38c6fb75ed86bfc20ad17e2e16a90ea02f62e499 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 3 Jun 2016 17:39:13 -0700 Subject: [PATCH 31/56] Added @viviangb to contributors --- CHANGELOG.md | 1 + CONTRIBUTORS.rst | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6362f495..bffc76890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Documentation for debugging with Docker (@mjsisley) - Apache 2 License option in `cookiecutter.json` (@dot2dotseurat) - Removed unnecessary version check from `pre_gen_project.py` (@suledev) +- Add gulp alternative as a js task runner and fix navbar style issue (@viviangb and @xpostudio4) ### Deleted - AngularJS (@pydanny) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 0f559e00b..d1d4f2f7d 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -114,8 +114,9 @@ Listed in alphabetical order. Théo Segonds `@show0k`_ Tom Atkins `@knitatoms`_ Tom Offermann - Travis McNeill `@Travistock`_ @tavistock_esq + Travis McNeill `@Travistock`_ @tavistock_esq Vitaly Babiy + Vivian Guillen `@viviangb`_ Yaroslav Halchenko ========================== ============================ ============== @@ -178,6 +179,7 @@ Listed in alphabetical order. .. _@suledev: https://github.com/suledev .. _@Travistock: https://github.com/Tavistock .. _@trungdong: https://github.com/trungdong +.. _@viviangb: httpsL//github.com/viviangb .. _@yunti: https://github.com/yunti .. _@zcho: https://github.com/zcho .. _@noisy: https://github.com/noisy From fc67ecf17431de8e879f07334e312e5259f599ed Mon Sep 17 00:00:00 2001 From: Audrey Roy Greenfeld Date: Fri, 3 Jun 2016 18:12:18 -0700 Subject: [PATCH 32/56] Remove use_angular option again --- cookiecutter.json | 1 - 1 file changed, 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index 2240a7d0b..fb01784ab 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -20,7 +20,6 @@ "use_python2": "n", "use_docker": "y", "use_heroku": "n", - "use_angular": "n", "js_task_runner": ["Gulp", "Grunt", "None"], "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] } From c5e984cf2365dba59061b930fe5fa14571c25659 Mon Sep 17 00:00:00 2001 From: Leonardo Jimenez Date: Fri, 3 Jun 2016 23:55:51 -0700 Subject: [PATCH 33/56] Include Licensing on the template --- LICENSE | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/LICENSE b/LICENSE index 9a5d2fc08..2afdb0d8c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,17 @@ -Copyright (c) 2013-2016, Daniel Greenfeld +{% if cookiecutter.open_source_license == 'MIT' %} +MIT License + +Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +{% elif cookiecutter.open_source_license == 'BSD' %} +BSD License + +Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -11,9 +24,9 @@ are permitted provided that the following conditions are met: list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of Cookiecutter Django nor the names of its contributors may - be used to endorse or promote products derived from this software without - specific prior written permission. +* Neither the name of {{ cookiecutter.project_name }} nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -21,7 +34,25 @@ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIME IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %} +Apache Software License 2.0 + +Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +{% endif %} From 95724dfbbc441936a39b9a13288ce4e415d61383 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sat, 4 Jun 2016 10:28:12 -0700 Subject: [PATCH 34/56] Add @chrisdev to contributors --- CHANGELOG.md | 4 ++++ CONTRIBUTORS.rst | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bffc76890..2ea494cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +##[2016-06-04] +### Added +- Let's Encrypt automation and instruction (@mjsisley and @chrisdev) + ##[2016-06-03] ### Added - Documentation for debugging with Docker (@mjsisley) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index e5164aca1..fb7be02e8 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -61,6 +61,7 @@ Listed in alphabetical order. Chris Franklin Chris Franklin `@hairychris`_ Chris Pappalardo `@ChrisPappalardo`_ + Christopher Clarke `@chrisdev`_ Collederas `@Collederas`_ Cristian Vargas `@cdvv7788`_ Cullen Rhodes `@c-rhodes`_ @@ -99,7 +100,6 @@ Listed in alphabetical order. Matt Warren `@mfwarren`_ Matthew Sisley `@mjsisley`_ Meghan Heintz `@dot2dotseurat`_ - mjsisley `@mjsisley`_ mozillazg `@mozillazg`_ Pablo `@oubiga`_ Raphael Pierzina `@hackebrot`_ @@ -138,6 +138,7 @@ Listed in alphabetical order. .. _@catherinedevlin: https://github.com/catherinedevlin .. _@ccurvey: https://github.com/ccurvey .. _@cdvv7788: https://github.com/cdvv7788 +.. _@chrisdev: https://github.com/chrisdev .. _@ChrisPappalardo: https://github.com/ChrisPappalardo .. _@Collederas: https://github.com/Collederas .. _@ddiazpinto: https://github.com/ddiazpinto @@ -184,7 +185,7 @@ Listed in alphabetical order. .. _@yunti: https://github.com/yunti .. _@zcho: https://github.com/zcho .. _@noisy: https://github.com/noisy -.. _@mjsisley: https://github.com/mjsisley + Special Thanks ~~~~~~~~~~~~~~ From e5b3b85620d0d00e5ac1f715659f4aa3a26154e9 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sat, 4 Jun 2016 16:11:14 -0700 Subject: [PATCH 35/56] Reorder index --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index b7b3885db..146c05572 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,7 +14,6 @@ Contents: .. toctree:: :maxdepth: 2 - my-favorite-cookie project-generation-options developing-locally developing-locally-docker @@ -26,6 +25,7 @@ Contents: deployment-with-docker faq troubleshooting + my-favorite-cookie Indices and tables ================== From b2d0a863448f383f1f944e9346ad82b9f3118b36 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sat, 4 Jun 2016 17:16:48 -0700 Subject: [PATCH 36/56] simplify cookiecutter.json --- README.rst | 2 -- cookiecutter.json | 2 -- docs/conf.py | 2 +- tests/test_cookiecutter_generation.py | 2 -- {{cookiecutter.project_slug}}/LICENSE | 4 ++-- {{cookiecutter.project_slug}}/docs/conf.py | 2 +- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 23fb79d64..915cfa9be 100644 --- a/README.rst +++ b/README.rst @@ -115,8 +115,6 @@ Answer the prompts with your own desired options_. For example:: domain_name [example.com]: myreddit.com version [0.1.0]: 0.0.1 timezone [UTC]: America/Los_Angeles - now [2016/03/01]: 2016/03/05 - year [2016]: use_whitenoise [y]: n use_celery [n]: y use_mailhog [n]: n diff --git a/cookiecutter.json b/cookiecutter.json index 8004d2988..0cae40739 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -7,8 +7,6 @@ "domain_name": "example.com", "version": "0.1.0", "timezone": "UTC", - "now": "{% now 'local' %}", - "year": "{{ cookiecutter.now[:4] }}", "use_whitenoise": "y", "use_celery": "n", "use_mailhog": "n", diff --git a/docs/conf.py b/docs/conf.py index 2fdeb69e6..d33c8f316 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -46,7 +46,7 @@ master_doc = 'index' # General information about the project. project = 'Cookiecutter Django' -copyright = '2013-{}, Daniel Roy Greenfeld'.format(now.year) +copyright = '2013-{% now 'utc', '%Y' %}, Daniel Roy Greenfeld'.format(now.year) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 6815751a8..e0e06ce6a 100644 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -22,8 +22,6 @@ def context(): 'domain_name': 'example.com', 'version': '0.1.0', 'timezone': 'UTC', - 'now': '2015/01/13', - 'year': '2015' } diff --git a/{{cookiecutter.project_slug}}/LICENSE b/{{cookiecutter.project_slug}}/LICENSE index e6d8e8103..413f8af56 100644 --- a/{{cookiecutter.project_slug}}/LICENSE +++ b/{{cookiecutter.project_slug}}/LICENSE @@ -1,6 +1,6 @@ {% if cookiecutter.open_source_license == 'MIT' %} The MIT License (MIT) -Copyright (c) {{ cookiecutter.year }}, {{ cookiecutter.author_name }} +Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }} Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -8,7 +8,7 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. {% elif cookiecutter.open_source_license == 'BSD' %} -Copyright (c) {{ cookiecutter.year }}, {{ cookiecutter.author_name }} +Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }} All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/{{cookiecutter.project_slug}}/docs/conf.py b/{{cookiecutter.project_slug}}/docs/conf.py index 78ca7ce5e..03cbe319b 100644 --- a/{{cookiecutter.project_slug}}/docs/conf.py +++ b/{{cookiecutter.project_slug}}/docs/conf.py @@ -44,7 +44,7 @@ master_doc = 'index' # General information about the project. project = '{{ cookiecutter.project_name }}' -copyright = """{{ cookiecutter.year }}, {{ cookiecutter.author_name }}""" +copyright = """{% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}""" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the From f40f30445799176a12628d89d66a90ddf4bc459b Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 10:47:07 -0700 Subject: [PATCH 37/56] Use sentry for error reporting --- README.rst | 3 +-- cookiecutter.json | 3 +-- docs/project-generation-options.rst | 2 +- {{cookiecutter.project_slug}}/Procfile | 2 +- {{cookiecutter.project_slug}}/README.rst | 2 +- {{cookiecutter.project_slug}}/app.json | 8 ++------ .../config/settings/production.py | 18 +++++++----------- {{cookiecutter.project_slug}}/config/wsgi.py | 13 ++----------- {{cookiecutter.project_slug}}/env.example | 6 +----- .../requirements/production.txt | 8 +------- .../taskapp/celery.py | 2 +- 11 files changed, 19 insertions(+), 48 deletions(-) diff --git a/README.rst b/README.rst index 915cfa9be..fa7c88d35 100644 --- a/README.rst +++ b/README.rst @@ -118,8 +118,7 @@ Answer the prompts with your own desired options_. For example:: use_whitenoise [y]: n use_celery [n]: y use_mailhog [n]: n - use_sentry [n]: y - use_newrelic [n]: y + use_sentry_for_error_reporting [y]: y use_opbeat [n]: y use_pycharm [n]: y windows [n]: n diff --git a/cookiecutter.json b/cookiecutter.json index 0cae40739..89148ec21 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -10,8 +10,7 @@ "use_whitenoise": "y", "use_celery": "n", "use_mailhog": "n", - "use_sentry": "n", - "use_newrelic": "n", + "use_sentry_for_error_reporting": "y", "use_opbeat": "n", "use_pycharm": "n", "windows": "n", diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 9ffad1e5f..2ea27c53b 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -39,7 +39,7 @@ use_mailhog [n] for development purposes. It runs a simple SMTP server which catches any message sent to it. Messages are displayed in a web interface which runs at ``http://localhost:8025/`` You need to download the MailHog executable for your operating system, see the 'Developing Locally' docs for instructions. -use_sentry [n] +use_sentry_for_error_reporting [n] Whether to use Sentry_ to log errors from your project. windows [n] diff --git a/{{cookiecutter.project_slug}}/Procfile b/{{cookiecutter.project_slug}}/Procfile index a5476341a..c77d76d96 100644 --- a/{{cookiecutter.project_slug}}/Procfile +++ b/{{cookiecutter.project_slug}}/Procfile @@ -1,4 +1,4 @@ web: gunicorn config.wsgi:application {% if cookiecutter.use_celery == "y" -%} -worker: {% if cookiecutter.use_newrelic == "y" %}newrelic-admin run-program {% endif %}celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info +worker: celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info {%- endif %} diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index 38d923b66..170f66a71 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -104,7 +104,7 @@ The email server will exit when you exit the Grunt task on the CLI with Ctrl+C. {% endif %} {% endif %} -{% if cookiecutter.use_sentry == "y" %} +{% if cookiecutter.use_sentry_for_error_reporting == "y" %} Sentry ^^^^^^ diff --git a/{{cookiecutter.project_slug}}/app.json b/{{cookiecutter.project_slug}}/app.json index 6e6585fd7..a23494587 100644 --- a/{{cookiecutter.project_slug}}/app.json +++ b/{{cookiecutter.project_slug}}/app.json @@ -20,12 +20,8 @@ "DJANGO_AWS_SECRET_ACCESS_KEY": "", "DJANGO_AWS_STORAGE_BUCKET_NAME": "", "DJANGO_MAILGUN_SERVER_NAME": "", - {% if cookiecutter.use_newrelic == "y" -%} - "NEW_RELIC_LICENSE_KEY": "", - "NEW_RELIC_APP_NAME": "", - {%- endif %} - "DJANGO_MAILGUN_API_KEY": ""{% if cookiecutter.use_sentry == "y" -%}, - "DJANGO_SENTRY_DSN": ""{%- endif %} + "DJANGO_MAILGUN_API_KEY": ""{% if cookiecutter.use_sentry_for_error_reporting == "y" -%}, + "DJANGO_SENTRY_DSN": ""{%- endif %} }, "scripts": { "postdeploy": "python manage.py migrate" diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 346bf7cb6..ae00b4723 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -6,7 +6,7 @@ Production Configurations - Use Amazon's S3 for storing static files and uploaded media - Use mailgun to send emails - Use Redis on Heroku -{% if cookiecutter.use_sentry == 'y' %} +{% if cookiecutter.use_sentry_for_error_reporting == 'y' %} - Use sentry for error logging {% endif %} {% if cookiecutter.use_opbeat == 'y' %} @@ -17,7 +17,7 @@ from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.utils import six -{% if cookiecutter.use_sentry == 'y' %} +{% if cookiecutter.use_sentry_for_error_reporting == 'y' %} import logging {% endif %} @@ -33,7 +33,8 @@ SECRET_KEY = env('DJANGO_SECRET_KEY') # This ensures that Django will be able to detect a secure connection # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') -{%- if cookiecutter.use_sentry == 'y'-%} + +{%- 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', ) @@ -44,7 +45,7 @@ INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', ) MIDDLEWARE_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES {% endif %} -{%- if cookiecutter.use_sentry == 'y' -%} +{%- if cookiecutter.use_sentry_for_error_reporting == 'y' -%} RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', ) MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES {% endif %} @@ -161,11 +162,6 @@ ANYMAIL = { } EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend" -{% if cookiecutter.use_newrelic == 'y'-%}# NEW RELIC -# ------------------------------------------------------------------------------ -NEW_RELIC_LICENSE_KEY = env('NEW_RELIC_LICENSE_KEY') -NEW_RELIC_APP_NAME = env('NEW_RELIC_APP_NAME') -{%- endif %} # TEMPLATE CONFIGURATION # ------------------------------------------------------------------------------ # See: @@ -195,7 +191,7 @@ CACHES = { } } -{% if cookiecutter.use_sentry == 'y' %} +{% if cookiecutter.use_sentry_for_error_reporting == 'y' %} # Sentry Configuration SENTRY_DSN = env('DJANGO_SENTRY_DSN') SENTRY_CLIENT = env('DJANGO_SENTRY_CLIENT', default='raven.contrib.django.raven_compat.DjangoClient') @@ -251,7 +247,7 @@ RAVEN_CONFIG = { 'CELERY_LOGLEVEL': env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO), 'DSN': SENTRY_DSN } -{% elif cookiecutter.use_sentry == 'n' %} +{% elif cookiecutter.use_sentry_for_error_reporting == 'n' %} # LOGGING CONFIGURATION # ------------------------------------------------------------------------------ # See: https://docs.djangoproject.com/en/dev/ref/settings/#logging diff --git a/{{cookiecutter.project_slug}}/config/wsgi.py b/{{cookiecutter.project_slug}}/config/wsgi.py index 4790b1b50..636f547a4 100644 --- a/{{cookiecutter.project_slug}}/config/wsgi.py +++ b/{{cookiecutter.project_slug}}/config/wsgi.py @@ -15,13 +15,8 @@ framework. """ import os -{% if cookiecutter.use_newrelic == 'y' -%} -if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production': - import newrelic.agent - newrelic.agent.initialize() -{%- endif %} from django.core.wsgi import get_wsgi_application -{% if cookiecutter.use_sentry == 'y' -%} +{% 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 {%- endif %} @@ -36,14 +31,10 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production") # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. application = get_wsgi_application() -{% if cookiecutter.use_sentry == 'y' -%} +{% if cookiecutter.use_sentry_for_error_reporting == 'y' -%} if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production': application = Sentry(application) {%- endif %} -{% if cookiecutter.use_newrelic == 'y' -%} -if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production': - application = newrelic.agent.WSGIApplicationWrapper(application) -{%- endif %} # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication # application = HelloWorldApplication(application) diff --git a/{{cookiecutter.project_slug}}/env.example b/{{cookiecutter.project_slug}}/env.example index bbea38b22..a982dc92f 100644 --- a/{{cookiecutter.project_slug}}/env.example +++ b/{{cookiecutter.project_slug}}/env.example @@ -12,13 +12,9 @@ DJANGO_MAILGUN_API_KEY= DJANGO_SERVER_EMAIL= DJANGO_SECURE_SSL_REDIRECT=False DJANGO_ACCOUNT_ALLOW_REGISTRATION=True -{% if cookiecutter.use_sentry == 'y' -%} +{% if cookiecutter.use_sentry_for_error_reporting == 'y' -%} DJANGO_SENTRY_DSN= {% endif %} -{% if cookiecutter.use_newrelic == 'y' -%} -NEW_RELIC_LICENSE_KEY= -NEW_RELIC_APP_NAME={{cookiecutter.project_slug}} -{% endif %} {% if cookiecutter.use_opbeat == 'y' -%} DJANGO_OPBEAT_ORGANIZATION_ID DJANGO_OPBEAT_APP_ID diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 5ac46e62d..16c7ea800 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -26,18 +26,12 @@ Collectfast==0.2.3 # ------------------------------------------------------- django-anymail==0.3.1 -{% if cookiecutter.use_sentry == "y" -%} +{% if cookiecutter.use_sentry_for_error_reporting == "y" -%} # Raven is the Sentry client # -------------------------- raven {%- endif %} -{% if cookiecutter.use_newrelic == "y" -%} -# Newrelic agent for performance monitoring -# ----------------------------------------- -newrelic -{%- endif %} - {% if cookiecutter.use_opbeat == "y" -%} # Opbeat agent for performance monitoring # ----------------------------------------- diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py index 44c57f7c1..7905e3660 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py @@ -24,7 +24,7 @@ class CeleryConfig(AppConfig): app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, force=True) - {% if cookiecutter.use_sentry == 'y' -%} + {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%} if hasattr(settings, 'RAVEN_CONFIG'): # Celery signal registration from raven import Client as RavenClient From fd2e7dd0fe2ca0ea4254cbbbc47eac1b84c5d9e1 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 11:04:48 -0700 Subject: [PATCH 38/56] Whitespace fix --- {{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 ae00b4723..e2bac6c9e 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -34,7 +34,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY') # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') -{%- if cookiecutter.use_sentry_for_error_reporting == 'y'-%} +{%- 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', ) From 783e7f644e2fc659d432d447bbbe6a01f2ac74c1 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 12:32:05 -0700 Subject: [PATCH 39/56] Fix #390 #450 --- .../{{cookiecutter.project_slug}}/users/admin.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py index bd437fe1e..ce6d8e13a 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py @@ -5,7 +5,6 @@ from django import forms from django.contrib import admin from django.contrib.auth.admin import UserAdmin as AuthUserAdmin from django.contrib.auth.forms import UserChangeForm, UserCreationForm - from .models import User @@ -24,7 +23,7 @@ class MyUserCreationForm(UserCreationForm): model = User def clean_username(self): - username = self.cleaned_data['username'] + username = self.cleaned_data["username"] try: User.objects.get(username=username) except User.DoesNotExist: @@ -33,6 +32,11 @@ class MyUserCreationForm(UserCreationForm): @admin.register(User) -class UserAdmin(AuthUserAdmin): +class MyUserAdmin(AuthUserAdmin): form = MyUserChangeForm add_form = MyUserCreationForm + fieldsets = ( + ('User Profile', {'fields': ('name',)}), + ) + AuthUserAdmin.fieldsets + list_display = ('username', 'name', 'is_superuser') + search_fields = ['name'] From 8e258ee611e55e76e5badab0a456def13d9f1549 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 12:33:36 -0700 Subject: [PATCH 40/56] Changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea494cfa..838b3dada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +##[2016-06-05] +### Added +- Configurable admin for users (@pydanny, @jayfk, @dezoito) + ##[2016-06-04] ### Added - Let's Encrypt automation and instruction (@mjsisley and @chrisdev) From a65a75046451f7c71c34574372e7358d2bef0509 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 13:17:19 -0700 Subject: [PATCH 41/56] Switch use_certbot to the MUCH more explicit use_letsencrypt --- cookiecutter.json | 2 +- hooks/post_gen_project.py | 8 ++++---- {{cookiecutter.project_slug}}/compose/nginx/Dockerfile | 2 +- {{cookiecutter.project_slug}}/compose/nginx/nginx.conf | 2 +- {{cookiecutter.project_slug}}/docker-compose.yml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 89148ec21..9b21f3cdc 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -18,6 +18,6 @@ "use_docker": "y", "use_heroku": "n", "js_task_runner": ["Gulp", "Grunt", "None"], - "use_certbot": "n", + "use_lets_encrypt": "n", "open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] } diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 22e9acb9e..0d970f3f8 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -215,7 +215,7 @@ else: remove_packageJSON_file() # 7. Removes all certbot/letsencrypt files if it isn't going to be used -if '{{ cookiecutter.use_certbot }}'.lower() != 'y': +if '{{ cookiecutter.use_lets_encrypt }}'.lower() != 'y': remove_certbot_files() # 8. Display a warning if use_docker and use_grunt are selected. Grunt isn't @@ -227,8 +227,8 @@ if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cook "js task runner service to your docker configuration manually." ) -# 9. Removes the certbot/letsencrypt files and display a warning if use_certbot is selected and use_docker isn't. -if '{{ cookiecutter.use_certbot }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y': +# 9. Removes the certbot/letsencrypt files and display a warning if use_lets_encrypt is selected and use_docker isn't. +if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y': remove_certbot_files() print( "You selected to use certbot(letsencrypt) and didn't select to use docker. This is NOT supported out of the box for now. You " @@ -236,7 +236,7 @@ if '{{ cookiecutter.use_certbot }}'.lower() == 'y' and '{{ cookiecutter.use_dock ) # 10. Directs the user to the documentation if certbot and docker are selected. -if '{{ cookiecutter.use_certbot }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': +if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( "You selected to use certbot(letsencrypt), please see the documentation for instructions on how to use this in production. " "You must generate a dhparams.pem file before running docker-compose in a production environment." diff --git a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile index 7bb605584..b9e7985f8 100644 --- a/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/nginx/Dockerfile @@ -1,7 +1,7 @@ FROM nginx:latest ADD nginx.conf /etc/nginx/nginx.conf -{% if cookiecutter.use_certbot == 'y' and cookiecutter.use_docker == 'y' %} +{% if cookiecutter.use_lets_encrypt == 'y' and cookiecutter.use_docker == 'y' %} ADD start.sh /start.sh ADD nginx-secure.conf /etc/nginx/nginx-secure.conf ADD dhparams.pem /etc/ssl/private/dhparams.pem diff --git a/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf b/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf index 54d955d7f..91bd96ec9 100644 --- a/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf +++ b/{{cookiecutter.project_slug}}/compose/nginx/nginx.conf @@ -35,7 +35,7 @@ http { listen 80; charset utf-8; - {% if cookiecutter.use_certbot == 'y' and cookiecutter.use_docker == 'y' %} + {% if cookiecutter.use_lets_encrypt == 'y' and cookiecutter.use_docker == 'y' %} server_name ___my.example.com___ ; location /.well-known/acme-challenge { diff --git a/{{cookiecutter.project_slug}}/docker-compose.yml b/{{cookiecutter.project_slug}}/docker-compose.yml index a67ec0bb4..f0c48406e 100644 --- a/{{cookiecutter.project_slug}}/docker-compose.yml +++ b/{{cookiecutter.project_slug}}/docker-compose.yml @@ -27,12 +27,12 @@ services: build: ./compose/nginx depends_on: - django -{% if cookiecutter.use_certbot == 'y' %} +{% if cookiecutter.use_lets_encrypt == 'y' %} - certbot {% endif %} ports: - "0.0.0.0:80:80" -{% if cookiecutter.use_certbot == 'y' %} +{% if cookiecutter.use_lets_encrypt == 'y' %} environment: - MY_DOMAIN_NAME={{ cookiecutter.domain_name }} ports: From c56e4ef61618280c12d7bba69d361c782194ecbd Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 14:16:02 -0700 Subject: [PATCH 42/56] Fix the remove file problem --- hooks/post_gen_project.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 0d970f3f8..c59d7d65f 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -82,6 +82,11 @@ def make_secret_key(project_directory): set_secret_key(env_file) +def remove_file(file_name): + if os.path.exists(file_name): + os.remove(file_name) + + def remove_task_app(project_directory): """Removes the taskapp if celery isn't going to be used""" # Determine the local_setting_file_location @@ -111,9 +116,8 @@ def remove_heroku_files(): Removes files needed for heroku if it isn't going to be used """ for filename in ["app.json", "Procfile", "requirements.txt", "runtime.txt"]: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) + file_name = os.path.join(PROJECT_DIRECTORY, filename) + remove_file(file_name) def remove_docker_files(): @@ -163,9 +167,8 @@ def remove_certbot_files(): """ nginx_dir_location = os.path.join(PROJECT_DIRECTORY, 'compose/nginx') for filename in ["nginx-secure.conf", "start.sh", "dhparams.example.pem"]: - os.remove(os.path.join( - nginx_dir_location, filename - )) + file_name = os.path.join(nginx_dir_location, filename) + remove_file(file_name) # IN PROGRESS # def copy_doc_files(project_directory): From df56488f01998a02fd8b25a350c1c9495afdb836 Mon Sep 17 00:00:00 2001 From: "requires.io" Date: Sun, 5 Jun 2016 16:30:17 -0700 Subject: [PATCH 43/56] [requires.io] dependency update --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d63bed873..3d6afb30e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ sh==1.11 binaryornot==0.4.0 # Testing -pytest==2.9.1 +pytest==2.9.2 pep8==1.7.0 pyflakes==1.2.3 tox==2.3.1 From 4f552745038028e75a0ff06dacd8c86ccae9853d Mon Sep 17 00:00:00 2001 From: "requires.io" Date: Sun, 5 Jun 2016 16:30:18 -0700 Subject: [PATCH 44/56] [requires.io] dependency update --- {{cookiecutter.project_slug}}/requirements/test.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt index 0451bc60f..b8531505a 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -7,10 +7,10 @@ psycopg2==2.6.1 {%- endif %} -coverage==4.0.3 -django_coverage_plugin==1.3 +coverage==4.1 +django-coverage-plugin==1.3.1 flake8==2.5.4 -django-test-plus==1.0.12 +django-test-plus==1.0.13 factory_boy==2.7.0 # pytest From d14be9939b9a3dd0855101ce69fb344731aa14cb Mon Sep 17 00:00:00 2001 From: "requires.io" Date: Sun, 5 Jun 2016 16:30:19 -0700 Subject: [PATCH 45/56] [requires.io] dependency update --- {{cookiecutter.project_slug}}/requirements/base.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 67a6fd6b0..5450a0988 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -7,17 +7,17 @@ wheel==0.29.0 {%- endif %} # Bleeding edge Django -django==1.9.6 +django==1.9.7 # Configuration django-environ==0.4.0 {% if cookiecutter.use_whitenoise == 'y' -%} -whitenoise==3.0 +whitenoise==3.2 {%- endif %} # Forms -django-braces==1.8.1 +django-braces==1.9.0 django-crispy-forms==1.6.0 django-floppyforms==1.6.2 @@ -47,7 +47,7 @@ django-autoslug==1.9.3 pytz==2016.4 # Redis support -django-redis==4.4.2 +django-redis==4.4.3 redis>=2.10.0 {% if cookiecutter.use_celery == "y" %} From 5408ccbef92575553544d367a022258cc446eeb0 Mon Sep 17 00:00:00 2001 From: "requires.io" Date: Sun, 5 Jun 2016 16:30:20 -0700 Subject: [PATCH 46/56] [requires.io] dependency update --- {{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 16c7ea800..2db9d2678 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -12,7 +12,7 @@ psycopg2==2.6.1 # WSGI Handler # ------------------------------------------------ gevent==1.1.1 -gunicorn==19.5.0 +gunicorn==19.6.0 # Static and Media Storage # ------------------------------------------------ From faa8eaf32dd9d33d6d281219c66d30bef1c2cd18 Mon Sep 17 00:00:00 2001 From: "requires.io" Date: Sun, 5 Jun 2016 16:30:21 -0700 Subject: [PATCH 47/56] [requires.io] dependency update --- {{cookiecutter.project_slug}}/requirements/local.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index c88093fef..0b43dde2d 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -1,11 +1,11 @@ # Local development dependencies go here -r base.txt -coverage==4.0.3 -django_coverage_plugin==1.3 +coverage==4.1 +django-coverage-plugin==1.3.1 Sphinx django-extensions==1.6.7 -Werkzeug==0.11.9 -django-test-plus==1.0.12 +Werkzeug==0.11.10 +django-test-plus==1.0.13 factory_boy==2.7.0 django-debug-toolbar==1.4 From 203afd5c19b44596beda62e88ce43fd34cddd0c5 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Sun, 5 Jun 2016 17:21:59 -0700 Subject: [PATCH 48/56] Fix borked Americanese to be English --- hooks/post_gen_project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index c59d7d65f..d83d92287 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -234,14 +234,14 @@ if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cook if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y': remove_certbot_files() print( - "You selected to use certbot(letsencrypt) and didn't select to use docker. This is NOT supported out of the box for now. You " - "can continue to use the project like you normally would, but you will no certbot files have been included" + "You selected to use Let's Encrypt and didn't select to use docker. This is NOT supported out of the box for now. You " + "can continue to use the project like you normally would, but Let's Encrypt files have been included." ) # 10. Directs the user to the documentation if certbot and docker are selected. if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( - "You selected to use certbot(letsencrypt), please see the documentation for instructions on how to use this in production. " + "You selected to use Let's Encrypt, please see the documentation for instructions on how to use this in production. " "You must generate a dhparams.pem file before running docker-compose in a production environment." ) From 83db25211d12c818cecfa6ed037e37434f8c151b Mon Sep 17 00:00:00 2001 From: kappataumu Date: Mon, 6 Jun 2016 13:47:26 +0000 Subject: [PATCH 49/56] Update Bootstrap CSS and JS to v4.0.0-alpha.2 minified. Fixes #589 --- .../{{cookiecutter.project_slug}}/templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html index a1e2a5ace..bc9dc5527 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html @@ -15,7 +15,7 @@ {% block css %} - + @@ -95,7 +95,7 @@ - + From 437e5898c7df254fcee436a11c3f9c9d3708c680 Mon Sep 17 00:00:00 2001 From: kappataumu Date: Mon, 6 Jun 2016 14:14:41 +0000 Subject: [PATCH 50/56] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 838b3dada..4c41c8ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +##[2016-06-06] +### Changed +- Pin Bootstrap CSS and JS to v4.0.0-alpha.2, use minified versions + ##[2016-06-05] ### Added - Configurable admin for users (@pydanny, @jayfk, @dezoito) From 7f1e4e29d692a8dd37af395759e9eafcc933476d Mon Sep 17 00:00:00 2001 From: kappataumu Date: Mon, 6 Jun 2016 14:15:41 +0000 Subject: [PATCH 51/56] Add self to CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index fb7be02e8..80025914b 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -83,6 +83,7 @@ Listed in alphabetical order. Jens Nilsson `@phiberjenz` Julio Castillo `@juliocc`_ Kaido Kert `@kaidokert`_ + kappataumu `@kappataumu`_ @kappataumu Kaveh `@ka7eh`_ Kevin A. Stone Kevin Ndung'u `@kevgathuku`_ @@ -162,6 +163,7 @@ Listed in alphabetical order. .. _@jvanbrug: https://github.com/jvanbrug .. _@ka7eh: https://github.com/ka7eh .. _@kaidokert: https://github.com/kaidokert +.. _@kappataumu: https://github.com/kappataumu .. _@kevgathuku: https://github.com/kevgathuku .. _@knitatoms: https://github.com/knitatoms .. _@MathijsHoogland: https://github.com/MathijsHoogland From b388ec1f57ac66748a94ebc14e303ab597f828a9 Mon Sep 17 00:00:00 2001 From: kappataumu Date: Mon, 6 Jun 2016 15:45:02 +0000 Subject: [PATCH 52/56] Fix malformed table in CONTRIBUTORS.rst (broke in 38c6fb75ed) --- CONTRIBUTORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 80025914b..cbec308a9 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -116,7 +116,7 @@ Listed in alphabetical order. Théo Segonds `@show0k`_ Tom Atkins `@knitatoms`_ Tom Offermann - Travis McNeill `@Travistock`_ @tavistock_esq + Travis McNeill `@Travistock`_ @tavistock_esq Vitaly Babiy Vivian Guillen `@viviangb`_ Yaroslav Halchenko From febd154ac84391bc15a0696b09f7a116d96ab60b Mon Sep 17 00:00:00 2001 From: kappataumu Date: Mon, 6 Jun 2016 16:24:19 +0000 Subject: [PATCH 53/56] Fix unknown target name docutil errors --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index cbec308a9..810dcea9e 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -187,6 +187,8 @@ Listed in alphabetical order. .. _@yunti: https://github.com/yunti .. _@zcho: https://github.com/zcho .. _@noisy: https://github.com/noisy +.. _@krzysztofzuraw: https://github.com/krzysztofzuraw +.. _@blopker: https://github.com/blopker Special Thanks ~~~~~~~~~~~~~~ From c881b4ec338c945820ec6d9ff37397c6d0fb4bad Mon Sep 17 00:00:00 2001 From: kappataumu Date: Mon, 6 Jun 2016 17:18:18 +0000 Subject: [PATCH 54/56] [OCD] Sort alphabetically even though not needed --- CONTRIBUTORS.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 810dcea9e..ee41b6b45 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -122,7 +122,6 @@ Listed in alphabetical order. Yaroslav Halchenko ========================== ============================ ============== -.. _@dezoito: https://github.com/dezoito .. _@a7p: https://github.com/a7p .. _@ad-m: https://github.com/ad-m .. _@aeikenberry: https://github.com/aeikenberry @@ -132,6 +131,7 @@ Listed in alphabetical order. .. _@areski: https://github.com/areski .. _@arruda: https://github.com/arruda .. _@bloodpet: https://github.com/bloodpet +.. _@blopker: https://github.com/blopker .. _@bogdal: https://github.com/bogdal .. _@burhan: https://github.com/burhan .. _@c-rhodes: https://github.com/c-rhodes @@ -143,6 +143,7 @@ Listed in alphabetical order. .. _@ChrisPappalardo: https://github.com/ChrisPappalardo .. _@Collederas: https://github.com/Collederas .. _@ddiazpinto: https://github.com/ddiazpinto +.. _@dezoito: https://github.com/dezoito .. _@dot2dotseurat: https://github.com/dot2dotseurat .. _@dsclementsen: https://github.com/dsclementsen .. _@epileptic-fish: https://gihub.com/epileptic-fish @@ -158,7 +159,6 @@ Listed in alphabetical order. .. _@ikkebr: https://github.com/ikkebr .. _@iynaix: https://github.com/iynaix .. _@jazztpt: https://github.com/jazztpt -.. _@xpostudio4: https://github.com/xpostudio4 .. _@juliocc: https://github.com/juliocc .. _@jvanbrug: https://github.com/jvanbrug .. _@ka7eh: https://github.com/ka7eh @@ -166,29 +166,29 @@ Listed in alphabetical order. .. _@kappataumu: https://github.com/kappataumu .. _@kevgathuku: https://github.com/kevgathuku .. _@knitatoms: https://github.com/knitatoms +.. _@krzysztofzuraw: https://github.com/krzysztofzuraw .. _@MathijsHoogland: https://github.com/MathijsHoogland .. _@menzenski: https://github.com/menzenski .. _@mfwarren: https://github.com/mfwarren .. _@mjsisley: https://github.com/mjsisley .. _@mozillazg: https://github.com/mozillazg +.. _@noisy: https://github.com/noisy .. _@originell: https://github.com/originell .. _@oubiga: https://github.com/oubiga -.. _@romanosipenko: https://github.com/romanosipenko .. _@raonyguimaraes: https://github.com/raonyguimaraes +.. _@romanosipenko: https://github.com/romanosipenko +.. _@shireenrao: https://github.com/shireenrao .. _@show0k: https://github.com/show0k .. _@siauPatrick: https://github.com/siauPatrick -.. _@shireenrao: https://github.com/shireenrao .. _@slafs: https://github.com/slafs .. _@stepmr: https://github.com/stepmr .. _@suledev: https://github.com/suledev .. _@Travistock: https://github.com/Tavistock .. _@trungdong: https://github.com/trungdong .. _@viviangb: httpsL//github.com/viviangb +.. _@xpostudio4: https://github.com/xpostudio4 .. _@yunti: https://github.com/yunti .. _@zcho: https://github.com/zcho -.. _@noisy: https://github.com/noisy -.. _@krzysztofzuraw: https://github.com/krzysztofzuraw -.. _@blopker: https://github.com/blopker Special Thanks ~~~~~~~~~~~~~~ From b8f58a08aa1b72a29a760d9f337f1ee56756a938 Mon Sep 17 00:00:00 2001 From: kappataumu Date: Tue, 7 Jun 2016 03:21:39 +0300 Subject: [PATCH 55/56] Fixes issue #588 (#597) --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index fa7c88d35..8836630a1 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,8 @@ Cookiecutter Django Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. -See Troubleshooting_ for common errors and obstacles. +* Documentation: https://cookiecutter-django.readthedocs.io +* See Troubleshooting_ for common errors and obstacles .. _cookiecutter: https://github.com/audreyr/cookiecutter From e24b777a412008558ffd60811f359d1309184d19 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Tue, 7 Jun 2016 15:19:25 -0700 Subject: [PATCH 56/56] Added direct signup --- {{cookiecutter.project_slug}}/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index 170f66a71..55a520c54 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -109,7 +109,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 http://getsentry.com or download and host it yourself. +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. The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application. You must set the DSN url in production.