mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
fixing an allauth setting bug
This commit is contained in:
parent
222635bf85
commit
7403679ee7
|
@ -24,11 +24,12 @@ Features
|
||||||
* Registration via django-allauth_
|
* Registration via django-allauth_
|
||||||
* Procfile_ for deploying to Heroku
|
* Procfile_ for deploying to Heroku
|
||||||
* Grunt build for compass and livereload
|
* Grunt build for compass and livereload
|
||||||
* Basic e-mail configurations for send emails via Mailgun_
|
* Basic e-mail configurations for sending emails via Mailgun_
|
||||||
* Media storage using Amazon S3
|
* Media storage using Amazon S3
|
||||||
* Serve static files from Amazon S3 or Whitenoise_ (optional)
|
* Serve static files from Amazon S3 or Whitenoise_ (optional)
|
||||||
* Pre configured Celery_ (optional)
|
* Pre configured Celery_ (optional)
|
||||||
* Integration with Maildump_ for local email testing (optional)
|
* Integration with Maildump_ for local email testing (optional)
|
||||||
|
* Integration with Sentry_ for error logging (optional)
|
||||||
|
|
||||||
.. _Bootstrap: https://github.com/twbs/bootstrap
|
.. _Bootstrap: https://github.com/twbs/bootstrap
|
||||||
.. _AngularJS: https://github.com/angular/angular.js
|
.. _AngularJS: https://github.com/angular/angular.js
|
||||||
|
@ -41,6 +42,7 @@ Features
|
||||||
.. _Whitenoise: https://whitenoise.readthedocs.org/
|
.. _Whitenoise: https://whitenoise.readthedocs.org/
|
||||||
.. _Celery: http://www.celeryproject.org/
|
.. _Celery: http://www.celeryproject.org/
|
||||||
.. _Maildump: https://github.com/ThiefMaster/maildump
|
.. _Maildump: https://github.com/ThiefMaster/maildump
|
||||||
|
.. _Sentry: https://getsentry.com
|
||||||
|
|
||||||
|
|
||||||
Constraints
|
Constraints
|
||||||
|
|
|
@ -12,5 +12,6 @@
|
||||||
"use_whitenoise": "y",
|
"use_whitenoise": "y",
|
||||||
"use_celery": "n",
|
"use_celery": "n",
|
||||||
"use_maildump": "n",
|
"use_maildump": "n",
|
||||||
|
"use_sentry": "n",
|
||||||
"windows": "n"
|
"windows": "n"
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ Environment Variable Django Setting Development
|
||||||
DJANGO_AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID n/a raises error
|
DJANGO_AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID n/a raises error
|
||||||
DJANGO_AWS_SECRET_ACCESS_KEY AWS_SECRET_ACCESS_KEY n/a raises error
|
DJANGO_AWS_SECRET_ACCESS_KEY AWS_SECRET_ACCESS_KEY n/a raises error
|
||||||
DJANGO_AWS_STORAGE_BUCKET_NAME AWS_STORAGE_BUCKET_NAME n/a raises error
|
DJANGO_AWS_STORAGE_BUCKET_NAME AWS_STORAGE_BUCKET_NAME n/a raises error
|
||||||
|
{% if cookiecutter.use_sentry == "y" -%}DJANGO_SENTRY_DSN SENTRY_DSN n/a raises error
|
||||||
|
DJANGO_SENTRY_CLIENT SENTRY_CLIENT n/a raven.contrib.django.raven_compat.DjangoClient
|
||||||
|
DJANGO_SENTRY_LOG_LEVEL SENTRY_LOG_LEVEL n/a logging.INFO{%- endif %}
|
||||||
DJANGO_MAILGUN_API_KEY MAILGUN_ACCESS_KEY n/a raises error
|
DJANGO_MAILGUN_API_KEY MAILGUN_ACCESS_KEY n/a raises error
|
||||||
DJANGO_MAILGUN_SERVER_NAME MAILGUN_SERVER_NAME n/a raises error
|
DJANGO_MAILGUN_SERVER_NAME MAILGUN_SERVER_NAME n/a raises error
|
||||||
======================================= =========================== ============================================== ======================================================================
|
======================================= =========================== ============================================== ======================================================================
|
||||||
|
@ -148,6 +151,15 @@ To stop the email server::
|
||||||
|
|
||||||
The email server listens on 127.0.0.1:1025
|
The email server listens on 127.0.0.1:1025
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if cookiecutter.use_sentry == "y" %}
|
||||||
|
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.
|
||||||
|
The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.
|
||||||
|
|
||||||
|
You must set the DSN url in production.
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
It's time to write the code!!!
|
It's time to write the code!!!
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,6 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.debug',
|
'django.template.context_processors.debug',
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'allauth.account.context_processors.account',
|
|
||||||
'allauth.socialaccount.context_processors.socialaccount',
|
|
||||||
'django.template.context_processors.i18n',
|
'django.template.context_processors.i18n',
|
||||||
'django.template.context_processors.media',
|
'django.template.context_processors.media',
|
||||||
'django.template.context_processors.static',
|
'django.template.context_processors.static',
|
||||||
|
|
|
@ -5,11 +5,13 @@ Production Configurations
|
||||||
- Use djangosecure
|
- Use djangosecure
|
||||||
- Use Amazon's S3 for storing static files and uploaded media
|
- Use Amazon's S3 for storing static files and uploaded media
|
||||||
- Use mailgun to send emails
|
- Use mailgun to send emails
|
||||||
- Use MEMCACHIER on Heroku
|
- Use Redis on Heroku
|
||||||
'''
|
'''
|
||||||
|
{% if cookiecutter.use_sentry == "y" %}
|
||||||
|
import raven
|
||||||
|
{% endif %}
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
|
|
||||||
from boto.s3.connection import OrdinaryCallingFormat
|
from boto.s3.connection import OrdinaryCallingFormat
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
|
@ -29,10 +31,25 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
INSTALLED_APPS += ("djangosecure", )
|
INSTALLED_APPS += ("djangosecure", )
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
{% if cookiecutter.use_sentry == "y" -%}
|
||||||
# Make sure djangosecure.middleware.SecurityMiddleware is listed first
|
# 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',
|
'djangosecure.middleware.SecurityMiddleware',
|
||||||
) + MIDDLEWARE_CLASSES
|
)
|
||||||
|
|
||||||
|
{% if cookiecutter.use_sentry == "y" -%}
|
||||||
|
RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
|
||||||
|
'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware',)
|
||||||
|
MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
# Make sure djangosecure.middleware.SecurityMiddleware is listed first
|
||||||
|
MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + MIDDLEWARE_CLASSES
|
||||||
|
|
||||||
|
|
||||||
# set this to 60 seconds and then to 518400 when you can prove it works
|
# set this to 60 seconds and then to 518400 when you can prove it works
|
||||||
SECURE_HSTS_SECONDS = 60
|
SECURE_HSTS_SECONDS = 60
|
||||||
|
@ -138,4 +155,55 @@ CACHES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if cookiecutter.use_sentry == "y" %}
|
||||||
|
# Sentry Configuration
|
||||||
|
SENTRY_CLIENT = env('DJANGO_SENTRY_CLIENT')
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': True,
|
||||||
|
'root': {
|
||||||
|
'level': 'WARNING',
|
||||||
|
'handlers': ['sentry'],
|
||||||
|
},
|
||||||
|
'formatters': {
|
||||||
|
'verbose': {
|
||||||
|
'format': '%(levelname)s %(asctime)s %(module)s '
|
||||||
|
'%(process)d %(thread)d %(message)s'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'sentry': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
|
||||||
|
},
|
||||||
|
'console': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'verbose'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.db.backends': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'raven': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'sentry.errors': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
SENTRY_CELERY_LOGLEVEL = env('DJANGO_SENTRY_LOG_LEVEL', logging.INFO)
|
||||||
|
RAVEN_CONFIG = {
|
||||||
|
'CELERY_LOGLEVEL': env('DJANGO_SENTRY_LOG_LEVEL', logging.INFO)
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Your production stuff: Below this line define 3rd party library settings
|
# Your production stuff: Below this line define 3rd party library settings
|
||||||
|
|
|
@ -19,6 +19,9 @@ from django.core.wsgi import get_wsgi_application
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||||
from whitenoise.django import DjangoWhiteNoise
|
from whitenoise.django import DjangoWhiteNoise
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{% if cookiecutter.use_sentry == "y" -%}
|
||||||
|
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
|
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
|
||||||
# if running multiple sites in the same mod_wsgi process. To fix this, use
|
# if running multiple sites in the same mod_wsgi process. To fix this, use
|
||||||
|
@ -36,6 +39,9 @@ application = get_wsgi_application()
|
||||||
# See: https://whitenoise.readthedocs.org/
|
# See: https://whitenoise.readthedocs.org/
|
||||||
application = DjangoWhiteNoise(application)
|
application = DjangoWhiteNoise(application)
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{% if cookiecutter.use_sentry == "y" -%}
|
||||||
|
application = Sentry(application)
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
# Apply WSGI middleware here.
|
# Apply WSGI middleware here.
|
||||||
# from helloworld.wsgi import HelloWorldApplication
|
# from helloworld.wsgi import HelloWorldApplication
|
||||||
|
|
|
@ -18,3 +18,9 @@ Collectfast==0.2.3
|
||||||
# Mailgun Support
|
# Mailgun Support
|
||||||
# ---------------
|
# ---------------
|
||||||
django-mailgun==0.2.2
|
django-mailgun==0.2.2
|
||||||
|
|
||||||
|
{% if cookiecutter.use_sentry == "y" -%}
|
||||||
|
# Raven is the Sentry client
|
||||||
|
# --------------------------
|
||||||
|
raven
|
||||||
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user