From 4b6707fe7bebbd849142fe8d75b42a3b5dbcf0ae Mon Sep 17 00:00:00 2001 From: Meghan Heintz Date: Fri, 3 Jun 2016 11:55:44 -0700 Subject: [PATCH 01/15] 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 00000000..fe121b9c --- /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 02/15] Adding troubleshotting to index --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index beafb44c..aa88fe24 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 03/15] 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 14dcf207..df192efc 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 6885547b6ae2bb606ed13eb4a11f9abf6939fa83 Mon Sep 17 00:00:00 2001 From: mjsisley Date: Fri, 3 Jun 2016 12:50:23 -0700 Subject: [PATCH 04/15] 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 03e9221c..85aef9c6 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 05/15] 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 0f849153..1b9bb5e6 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 4e0bc3bc..5a0ab6eb 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 06/15] 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 8fe7010a..686b8fd6 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 07/15] Tracking more work by @dot2dotseurat --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b9bb5e6..9657565b 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 08/15] 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 df192efc..3e906217 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 686b8fd6..36aa3c30 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 b5469222..a1e2a5ac 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 09/15] 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 9657565b..088fb47a 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 3e906217..23fb79d6 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 ffc83080c77ff866cf2c9e868d2100bd13890406 Mon Sep 17 00:00:00 2001 From: Emily C Date: Fri, 3 Jun 2016 15:23:00 -0700 Subject: [PATCH 10/15] 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 aa88fe24..b7b3885d 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 00000000..a6583352 --- /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 11/15] 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 11985690..a7f0269f 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 907b8ecfbda0e54b1cf535476b7127434db8585a Mon Sep 17 00:00:00 2001 From: Leonardo Date: Fri, 3 Jun 2016 16:07:27 -0700 Subject: [PATCH 12/15] 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 3668b427..3e11ee43 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 80302bee..346bf7cb 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 f5e35acd..67a6fd6b 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 13/15] 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 088fb47a..3038b6f5 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 5a0ab6eb..99239b71 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 14/15] 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 36aa3c30..65879a69 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 3dfc190a..9cd168bc 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 15/15] 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 3038b6f5..f6362f49 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 99239b71..0f559e00 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