· 9 years ago · Feb 01, 2017, 06:34 AM
1"""
2Django settings for ego project.
3
4Generated by 'django-admin startproject' using Django 1.9.7.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.9/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.9/ref/settings/
11"""
12
13from __future__ import absolute_import
14import os
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = '57a-r%=$vsn$#$+)%)d)(v_%*iucz46zg=+sod8*6g6a4ey98i'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = ['localhost', '127.0.0.1', '52.42.253.5', '54.146.139.230',
29 '172.19.24.23']
30
31# Application definition
32
33INSTALLED_APPS = [
34 'django.contrib.admin',
35 'django.contrib.auth',
36 'django.contrib.contenttypes',
37 'django.contrib.sessions',
38 'django.contrib.messages',
39 'django.contrib.staticfiles',
40 'main',
41 "sslserver",
42 'djcelery',
43 "celery_tasks",
44]
45
46MIDDLEWARE_CLASSES = [
47 'django.middleware.security.SecurityMiddleware',
48 'django.contrib.sessions.middleware.SessionMiddleware',
49 'django.middleware.common.CommonMiddleware',
50 'django.middleware.csrf.CsrfViewMiddleware',
51 'django.contrib.auth.middleware.AuthenticationMiddleware',
52 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
53 'django.contrib.messages.middleware.MessageMiddleware',
54 'django.middleware.clickjacking.XFrameOptionsMiddleware',
55]
56
57ROOT_URLCONF = 'ego.urls'
58
59TEMPLATES = [
60 {
61 'BACKEND': 'django.template.backends.django.DjangoTemplates',
62 'DIRS': [],
63 'APP_DIRS': True,
64 'OPTIONS': {
65 'context_processors': [
66 'django.template.context_processors.debug',
67 'django.template.context_processors.request',
68 'django.contrib.auth.context_processors.auth',
69 'django.contrib.messages.context_processors.messages',
70 ],
71 },
72 },
73]
74
75WSGI_APPLICATION = 'ego.wsgi.application'
76
77# Database
78# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
79
80DATABASES = {
81 'default': {
82 'ENGINE': 'django.db.backends.dummy'
83 }
84}
85
86TEST_MONGO_DATABASE = {
87 'db': 'testing',
88 'host': ['localhost'],
89 'port': 27017,
90}
91
92# To display stdout from testing.
93NOSE_ARGS = ['--nocapture', ] # '--nologcapture',
94
95from mongoengine import connect
96# connect(<db-name>, username='my_username', password='secret_password')
97connect('vulcan')
98
99# Password validation
100# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
101
102AUTH_PASSWORD_VALIDATORS = [
103 {
104 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
105 },
106 {
107 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
108 },
109 {
110 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
114 },
115]
116
117# Internationalization
118# https://docs.djangoproject.com/en/1.9/topics/i18n/
119
120LANGUAGE_CODE = 'en-us'
121
122TIME_ZONE = 'UTC'
123
124USE_I18N = True
125
126USE_L10N = True
127
128USE_TZ = True
129
130# Static files (CSS, JavaScript, Images)
131# https://docs.djangoproject.com/en/1.9/howto/static-files/
132
133STATIC_URL = '/static/'
134
135import djcelery
136djcelery.setup_loader()
137
138from celery.schedules import crontab
139
140CELERY_RESULT_BACKEND = "mongodb"
141CELERY_MONGODB_BACKEND_SETTINGS = {
142 "host": "127.0.0.1",
143 "port": 27017,
144 "database": "celery",
145 "taskmeta_collection": "my_taskmeta" # Collection name to use for task output
146}
147
148BROKER_BACKEND = "mongodb"
149BROKER_HOST = "localhost"
150BROKER_PORT = 27017
151BROKER_USER = ""
152BROKER_PASSWORD = ""
153BROKER_VHOST = "celery"
154
155# Find and register all celery tasks. Your tasks need to be in a
156# tasks.py file to be picked up.
157CELERY_IMPORTS = ('celery_tasks.tasks', )
158
159CELERYBEAT_SCHEDULE = {
160 'every-15-minute_visit': {
161 'task': 'ego.celeryapp.visit_completion',
162 'schedule': crontab(minute='*/15'),
163 },
164 'every-15-minute_order': {
165 'task': 'ego.celeryapp.order_completion',
166 'schedule': crontab(minute='*/15'),
167 },
168 'every-day-mobile-analytics-summary': {
169 'task': 'ego.celeryapp.mobile_analytics_task',
170 'schedule': crontab(minute="0", hour="12", day_of_week='*',
171 day_of_month='*', month_of_year='*'),
172 },
173}