2018-05-05 22:18:02 +00:00
|
|
|
"""
|
|
|
|
Django settings for mooc project.
|
|
|
|
|
|
|
|
Generated by 'django-admin startproject' using Django 1.8.3.
|
|
|
|
|
|
|
|
For more information on this file, see
|
|
|
|
https://docs.djangoproject.com/en/1.8/topics/settings/
|
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
|
|
|
https://docs.djangoproject.com/en/1.8/ref/settings/
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
|
import os
|
|
|
|
|
|
|
|
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 = 'pxf234t25323vasfk3t202v2232v124'
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
DEBUG = False
|
2018-05-06 10:35:06 +00:00
|
|
|
#DEBUG = True
|
2018-05-05 22:18:02 +00:00
|
|
|
|
|
|
|
ALLOWED_HOSTS = ['localhost', 'oer.hps.vi4io.org']
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
# 'djangosecure',
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
# 3rd party
|
|
|
|
#'rest_framework',
|
|
|
|
'cookielaw',
|
2019-06-28 16:26:41 +00:00
|
|
|
#'django_social_project',
|
2018-05-05 22:18:02 +00:00
|
|
|
'social.apps.django_app.default',
|
|
|
|
|
|
|
|
# project
|
|
|
|
'main',
|
|
|
|
'courses',
|
|
|
|
'frontend',
|
2018-05-05 23:46:11 +00:00
|
|
|
'rest',
|
2018-05-05 22:18:02 +00:00
|
|
|
'generated_exercises', #TODO FIXME
|
|
|
|
'tools'
|
|
|
|
)
|
|
|
|
|
2018-05-05 23:04:26 +00:00
|
|
|
MIDDLEWARE = (
|
2019-06-28 16:26:41 +00:00
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
2018-05-05 22:18:02 +00:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2018-05-05 23:04:26 +00:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
2018-05-05 22:18:02 +00:00
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
)
|
|
|
|
|
2019-06-28 16:26:41 +00:00
|
|
|
CSRF_TRUSTED_ORIGINS = ['oer.hps.vi4io.org']
|
|
|
|
CSRF_COOKIE_DOMAIN = "oer.hps.vi4io.org"
|
|
|
|
|
|
|
|
|
2018-05-05 22:18:02 +00:00
|
|
|
#SECURE_SSL_REDIRECT = True
|
|
|
|
#SESSION_COOKIE_SECURE = True
|
|
|
|
#CSRF_COOKIE_SECURE = True
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'main.urls'
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
os.path.join(BASE_DIR, 'templates'),
|
|
|
|
],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
'social.apps.django_app.context_processors.backends',
|
|
|
|
'social.apps.django_app.context_processors.login_redirect',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'main.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, '../data/db2.sqlite3'),
|
|
|
|
# }
|
|
|
|
|
|
|
|
# postgresql
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
'NAME': 'hoou',
|
|
|
|
'USER': 'hoou',
|
|
|
|
'PASSWORD': 'hoohoohoo123',
|
|
|
|
'HOST': 'localhost',
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/1.8/topics/i18n/
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
STATIC_ROOT = '/data/run/static/'
|
|
|
|
|
|
|
|
# OAuth / OpenID Login Settings
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
#'social.backends.open_id.OpenIdAuth',
|
2019-06-28 16:26:41 +00:00
|
|
|
#'social.backends.facebook.FacebookOAuth2',
|
|
|
|
#'social.backends.google.GoogleOAuth2',
|
2018-05-05 22:18:02 +00:00
|
|
|
'social.backends.github.GithubOAuth2',
|
2019-06-28 16:26:41 +00:00
|
|
|
#'social.backends.twitter.TwitterOAuth',
|
|
|
|
#'social.backends.reddit.RedditOAuth2',
|
2018-05-05 22:18:02 +00:00
|
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
|
|
)
|
|
|
|
|
|
|
|
# GitHub
|
2019-06-28 16:26:41 +00:00
|
|
|
SOCIAL_AUTH_GITHUB_KEY = '6187640bb1463a22ed04'
|
|
|
|
SOCIAL_AUTH_GITHUB_SECRET = '18986199a1ed32bc459e9c12df7f12489eccc63e'
|
2018-05-05 22:18:02 +00:00
|
|
|
|
|
|
|
# Reddit
|
2019-06-28 16:26:41 +00:00
|
|
|
#SOCIAL_AUTH_REDDIT_KEY = 'vAGMBJBPdnzLIw'
|
|
|
|
#SOCIAL_AUTH_REDDIT_SECRET = 'riQyRWFrFZJKHLihG0_Y8cwO4cQ'
|
|
|
|
#SOCIAL_AUTH_REDDIT_AUTH_EXTRA_ARGUMENTS = {'duration': 'permanent'}
|
2018-05-05 22:18:02 +00:00
|
|
|
|
|
|
|
# Twitter
|
2019-06-28 16:26:41 +00:00
|
|
|
#SOCIAL_AUTH_TWITTER_KEY = 'kzONnzGZ1CKUATgSPx6BeMSjD'
|
|
|
|
#SOCIAL_AUTH_TWITTER_SECRET = 'oIsRdyUafNgXIWQ7pjWisfgAFTOiKX9gBDWARc3wcwiO1Ay2dN'
|
2018-05-05 22:18:02 +00:00
|
|
|
|
|
|
|
# Google
|
2019-06-28 16:26:41 +00:00
|
|
|
#SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '477896675547-pocqb7irgjttea34dc5efmtj8lqketaa.apps.googleusercontent.com'
|
|
|
|
#SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'TbdZdorX_YNyLJ9_y8ldBwuV'
|
2018-05-05 22:18:02 +00:00
|
|
|
|
|
|
|
# Facebook
|
2019-06-28 16:26:41 +00:00
|
|
|
#SOCIAL_AUTH_FACEBOOK_KEY = '1651995468422055'
|
|
|
|
#SOCIAL_AUTH_FACEBOOK_SECRET = '79b7652a72397e6f4b05e097d735e0e5'
|
|
|
|
#SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
|
2018-05-05 22:18:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PIPELINE = (
|
|
|
|
'social.pipeline.social_auth.social_details',
|
|
|
|
'social.pipeline.social_auth.social_uid',
|
|
|
|
'social.pipeline.social_auth.auth_allowed',
|
|
|
|
'social.pipeline.social_auth.social_user',
|
|
|
|
'social.pipeline.user.get_username',
|
|
|
|
# 'social.pipeline.mail.mail_validation',
|
|
|
|
'social.pipeline.social_auth.associate_by_email',
|
|
|
|
'social.pipeline.user.create_user',
|
|
|
|
'social.pipeline.social_auth.associate_user',
|
|
|
|
'social.pipeline.social_auth.load_extra_data',
|
|
|
|
'social.pipeline.user.user_details'
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-06-28 16:26:41 +00:00
|
|
|
|
|
|
|
CSRF_COOKIE_DOMAIN = "oer.hps.vi4io.org"
|
|
|
|
|
|
|
|
SOCIAL_AUTH_LOGIN_REDIRECT_URL = ''
|
|
|
|
#SOCIAL_AUTH_LOGIN_URL = '/'
|
|
|
|
|