Skip to content

Commit

Permalink
Changed settings.py to be documented a little better.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurora0000 committed Jun 7, 2015
1 parent 9e14dcc commit c3bf01b
Showing 1 changed file with 71 additions and 40 deletions.
111 changes: 71 additions & 40 deletions descant/settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"""
Django settings for descant project.
Generated by 'django-admin startproject' using Django 1.8.1.
**CONSIDER USING ENVIRONMENT VARIABLES FOR GREATER SECURITY**
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
**BEFORE DEPLOYING, RUN THIS:**
manage.py check --deploy
**ALSO, READ THIS:**
https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
**REMEMBER, RUN THAT COMMAND ABOVE, OR REGRET IT LATER!**
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
Expand All @@ -16,22 +20,12 @@

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '1g72n-3b=b^!x-_p7tcz58f!p)sg#^r!!vm2v^$i8q874&k9qu'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
# Scroll down to the bottom for configuration settings that you need to change.
# You probably don't need to touch any of the settings below unless you're tinkering
# with Descant's source.

SITE_ID = 1

# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
Expand Down Expand Up @@ -92,37 +86,13 @@
WSGI_APPLICATION = 'descant.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
),
}

DJOSER = {
'DOMAIN': 'localhost',
'SITE_NAME': 'Descant Forum',
'PASSWORD_RESET_CONFIRM_URL': 'api/auth/password/reset/confirm/{uid}/{token}',
'ACTIVATION_URL': 'api/auth/activate/{uid}/{token}',
'LOGIN_AFTER_ACTIVATION': True,
'SEND_ACTIVATION_EMAIL': True,
}


if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '/tmp/descant-emails'

# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

Expand Down Expand Up @@ -175,3 +145,64 @@
'acronym': ['title'],
'img': ['src', 'alt']
}


## EDIT THESE ##

# Change this to a long, random and secure string. Do not release
# it publicly anywhere, or your security will be compromised.
SECRET_KEY = '1g72n-3b=b^!x-_p7tcz58f!p)sg#^r!!vm2v^$i8q874&k9qu'

# Disable debug when your server is working fine.
DEBUG = True

# Set this to your domain name, or Django will crash when Debug is
# turned off.
ALLOWED_HOSTS = []

# Set up your email configuration here
# Get configuration information at:
# https://docs.djangoproject.com/en/1.8/ref/settings/#email-backend
if DEBUG:
# If debug is on, log emails to a file
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '/tmp/descant-emails'
else:
# Make sure to update these. Again, ensure that your auth details
# remain private.
EMAIL_HOST = 'localhost'
EMAIL_PORT = 587
EMAIL_USE_TLS = True

EMAIL_HOST_USER = 'misconfigured'
EMAIL_HOST_PASSWORD = 'misconfigured'

# Database settings, get more information at:
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

# The config below will work fine for SQLite, but you'll get better
# performance with Postgres or MySQL.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

# Change these settings to something more appropriate
DJOSER = {
# Set this to your domain (it'll be put on emails, etc)
'DOMAIN': 'localhost',
# Include your site's name here
'SITE_NAME': 'Descant Forum',
# Currently not available in the front-end UI, so users will have to interact
# with the API directly
'PASSWORD_RESET_CONFIRM_URL': 'api/auth/password/reset/confirm/{uid}/{token}',
# Change this to <frontend_url>/#/activate?uid={uid}&token={token}
# Make sure to replace <frontend_url> with the actual front-end URL,
# relative to 'DOMAIN', like this: forums/#/activate?uid={uid}&token={token}
'ACTIVATION_URL': 'api/auth/activate/{uid}/{token}',
# Don't touch these.
'LOGIN_AFTER_ACTIVATION': True,
'SEND_ACTIVATION_EMAIL': True,
}

0 comments on commit c3bf01b

Please sign in to comment.