Commit 91ea958d authored by Mirko Vucicevich's avatar Mirko Vucicevich

rejig settings

parent 9ad006c4
......@@ -5,6 +5,7 @@ docs/
solr/
media/
scinage/settings_local.py
scinage/settings.py
whoosh_index/
*.bak
bin/
......
"""
Django settings for scinage project.
import os
Generated by 'django-admin startproject' using Django 1.8.5.
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
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/
"""
try:
from .settings_local import *
except Exception as e:
from .settings_local_example import *
# Application definition
INSTALLED_APPS = (
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -29,27 +15,26 @@ INSTALLED_APPS = (
'haystack',
'taggit',
'layers',
# 'undelete',
'rest_framework',
'django_cas_ng',
'sass_processor',
#'independoc',
)
]
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'scinage.middleware.UserMaskMiddleware',
]
ROOT_URLCONF = 'scinage.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......@@ -57,27 +42,31 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'scinage.context_processors.newlysaved',
],
},
},
]
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
WSGI_APPLICATION = 'scinage.wsgi.application'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
WSGI_APPLICATION = 'scinage.wsgi.application'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/Toronto'
USE_I18N = True
......@@ -85,9 +74,9 @@ USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
TIME_ZONE = 'America/Toronto'
MEDIA_URL = '/media/'
CRISPY_TEMPLATE_PACK = 'bootstrap3'
......@@ -101,5 +90,4 @@ DOC_URL = '/static/documentation/index.html'
COMPRESS_ROOT = '/static/css/'
LOGIN_REDIRECT_URL ='/'
STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = '/'
\ No newline at end of file
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
from .settings_base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@ieti4$o(7jf8_3*kz0x5d6hb4z$@1rhh=_u)=b2g@o1n+eoi5'
......@@ -11,15 +8,6 @@ DEBUG = True
ALLOWED_HOSTS = []
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
......@@ -27,14 +15,11 @@ DATABASES = {
}
}
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
HAYSTACK_CONNECTIONS = {
'default': {
......@@ -43,25 +28,6 @@ HAYSTACK_CONNECTIONS = {
},
}
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'django_cas_ng.backends.CASBackend',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'cas.middleware.CASMiddleware',
'scinage.middleware.UserMaskMiddleware',
)
CAS_SERVER_URL = "https://cas.uwaterloo.ca/cas/"
TWITTER_KEYS = (
'....',
......@@ -72,8 +38,13 @@ TWITTER_TOKEN_KEYS = (
'...',
)
# Email related variables, these are used for sending emails related to the
# password reset process
EMERGENCY_ALERTS_ENABLED = True
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = '<smtp.gmail.com | OR OTHER HOST>'
EMAIL_USE_TLS = True
......@@ -81,20 +52,8 @@ EMAIL_PORT = 587
EMAIL_HOST_USER = '<EMAIL ADDRESS>'
EMAIL_HOST_PASSWORD = '<EMAIL PASSWORD>'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
},
},
}
EMERGENCY_ALERTS_ENABLED = True
# Change these to handle alternate auth methoids
ROOT_URLCONF = 'scinage.default_urls'
LOGIN_URL = '/auth/login'
LOGOUT_URL = '/auth/logout'
\ No newline at end of file
# The default URL settings for scinage. Uses local auth.
# Write a new setup to handle non-local auth if needed
from django.urls import path
from django.contrib.admin import site
urlpatterns = [
path('login', site.login, name='login'),
path('logout', site.logout, name='logout'),
path('', include('scinage.urls'))
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment