· 7 years ago · Aug 29, 2018, 04:36 PM
1os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tango_with_django.settings")
2
3--chimpy
4 -botApp
5 -settings
6 -base.py
7 -production.py
8 -wsgi.py
9 -manage.py
10
11"""
12Django settings for botApp project.
13
14Generated by 'django-admin startproject' using Django 2.0.5.
15
16For more information on this file, see
17https://docs.djangoproject.com/en/2.0/topics/settings/
18
19For the full list of settings and their values, see
20https://docs.djangoproject.com/en/2.0/ref/settings/
21"""
22
23import os
24
25# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
26BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
27
28
29# Quick-start development settings - unsuitable for production
30# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
31
32# SECURITY WARNING: keep the secret key used in production secret!
33SECRET_KEY = 'whatever'
34
35# SECURITY WARNING: don't run with debug turned on in production!
36DEBUG = False
37
38ALLOWED_HOSTS = ['*']
39
40LOCALE_PATHS = [
41 os.path.join(BASE_DIR, '../../locale'),
42]
43
44# Application definition
45
46INSTALLED_APPS = [
47 'django.contrib.admin',
48 'django.contrib.auth',
49 'django.contrib.contenttypes',
50 'django.contrib.sessions',
51 'django.contrib.messages',
52 'django.contrib.staticfiles',
53 'profiles',
54 'portfolios',
55 'django_extensions',
56 'rest_framework',
57 'corsheaders',
58]
59
60MIDDLEWARE = [
61 'django.middleware.security.SecurityMiddleware',
62 'django.contrib.sessions.middleware.SessionMiddleware',
63 'django.middleware.common.CommonMiddleware',
64 'django.middleware.csrf.CsrfViewMiddleware',
65 'django.contrib.auth.middleware.AuthenticationMiddleware',
66 'django.contrib.messages.middleware.MessageMiddleware',
67 'django.middleware.clickjacking.XFrameOptionsMiddleware',
68 'corsheaders.middleware.CorsMiddleware',
69 'django.middleware.common.CommonMiddleware',
70]
71
72ROOT_URLCONF = 'botApp.urls'
73
74TEMPLATES = [
75 {
76 'BACKEND': 'django.template.backends.django.DjangoTemplates',
77 'DIRS': [os.path.join(BASE_DIR, '../../templates')],
78 'APP_DIRS': True,
79 'OPTIONS': {
80 'context_processors': [
81 'django.template.context_processors.debug',
82 'django.template.context_processors.request',
83 'django.contrib.auth.context_processors.auth',
84 'django.contrib.messages.context_processors.messages',
85 ],
86 'libraries':{
87 'proper_paginate': 'portfolios.proper_paginate',
88 'url_replace': 'portfolios.url_replace',
89 }
90 },
91 },
92]
93
94WSGI_APPLICATION = 'botApp.settings.wsgi.application'
95
96
97# Database
98# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
99
100
101DATABASES = {
102 'default': {
103 'ENGINE': 'django.db.backends.postgresql_psycopg2',
104 'NAME': 'django_db',
105 'USER': 'db_user',
106 'PASSWORD': 'whatever',
107 'HOST': 'localhost',
108 'PORT': '',
109 }
110}
111
112
113
114
115
116
117# Password validation
118# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
119
120AUTH_PASSWORD_VALIDATORS = [
121 {
122 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
123 },
124 {
125 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
126 },
127 {
128 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
129 },
130 {
131 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
132 },
133]
134
135
136# Internationalization
137# https://docs.djangoproject.com/en/2.0/topics/i18n/
138
139LANGUAGE_CODE = 'en-us'
140
141TIME_ZONE = 'UTC'
142
143USE_I18N = True
144
145USE_L10N = True
146
147USE_TZ = True
148
149
150# Static files (CSS, JavaScript, Images)
151# https://docs.djangoproject.com/en/2.0/howto/static-files/
152# Static files (CSS, JavaScript, Images)
153# https://docs.djangoproject.com/en/2.0/howto/static-files/
154
155STATIC_URL = '/static/'
156STATICFILES_DIRS = [os.path.join(BASE_DIR, "../../static"), '/Users/ibotics/suribit/static', ]
157STATIC_ROOT = "/Users/ibotics/suribit/static_cdn"
158
159TEMPLATE_DIRS = ('/templates/',)
160
161LOGIN_URL = '/login'
162# media config missing
163# static cdn missing?
164
165CORS_ORIGIN_ALLOW_ALL = True
166CORS_ALLOW_CREDENTIALS = True
167CORS_ORIGIN_WHITELIST = (
168 'localhost:8080','localhost:8000',
169)
170CORS_ORIGIN_REGEX_WHITELIST = (
171 'localhost:8080','localhost:8000',
172)
173
174from .base import *
175DEBUG = False
176ALLOWED_HOSTS = ['*']
177
178import os
179from django.core.wsgi import get_wsgi_application
180os.environ.setdefault("DJANGO_SETTINGS_MODULE", "botApp.settings.production")
181application = get_wsgi_application()
182
183#!/usr/bin/env python
184import os
185import sys
186
187if __name__ == "__main__":
188 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "botApp.settings.production")
189 try:
190 from django.core.management import execute_from_command_line
191 except ImportError as exc:
192 raise ImportError(
193 "Couldn't import Django. Are you sure it's installed and "
194 "available on your PYTHONPATH environment variable? Did you "
195 "forget to activate a virtual environment?"
196 ) from exc
197 execute_from_command_line(sys.argv)
198
199gunicorn botApp.wsgi:application --bind 0.0.0.0:8001