|
| 1 | +""" |
| 2 | +Django settings for steepshot_io project. |
| 3 | +
|
| 4 | +Generated by 'django-admin startproject' using Django 1.11. |
| 5 | +
|
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/1.11/topics/settings/ |
| 8 | +
|
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/1.11/ref/settings/ |
| 11 | +""" |
| 12 | + |
| 13 | +import os |
| 14 | +import dj_database_url |
| 15 | + |
| 16 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
| 17 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 18 | + |
| 19 | + |
| 20 | +# Quick-start development settings - unsuitable for production |
| 21 | +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ |
| 22 | + |
| 23 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 24 | +SECRET_KEY = os.getenv('SECRET_KEY') |
| 25 | + |
| 26 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 27 | +if os.getenv('DJANGO_DEBUG'): |
| 28 | + DEBUG = os.getenv('DJANGO_DEBUG') == 'True' |
| 29 | +else: |
| 30 | + DEBUG = False |
| 31 | + |
| 32 | +if os.getenv('DJANGO_LOCAL'): |
| 33 | + LOCAL = os.getenv('DJANGO_LOCAL') == 'True' |
| 34 | +else: |
| 35 | + LOCAL = False |
| 36 | + |
| 37 | +PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) |
| 38 | + |
| 39 | +if DEBUG: |
| 40 | + ALLOWED_HOSTS = ['*'] |
| 41 | +else: |
| 42 | + ALLOWED_HOSTS = [] |
| 43 | + |
| 44 | +PROJECT_NAME = 'steepshot_io' |
| 45 | + |
| 46 | +STEEM_NODE = 'wss://steemd.steemit.com' |
| 47 | +GOLOS_NODE = 'wss://ws.golos.io' |
| 48 | + |
| 49 | +IS_STEEM_CHAIN = True |
| 50 | +IS_GOLOS_CHAIN = not IS_STEEM_CHAIN |
| 51 | + |
| 52 | +if IS_STEEM_CHAIN: |
| 53 | + CURRENT_NODE = STEEM_NODE |
| 54 | +elif IS_GOLOS_CHAIN: |
| 55 | + CURRENT_NODE = GOLOS_NODE |
| 56 | +else: |
| 57 | + CURRENT_NODE = u'' |
| 58 | + |
| 59 | +# Application definition |
| 60 | + |
| 61 | +INSTALLED_APPS = [ |
| 62 | + 'django.contrib.admin', |
| 63 | + 'django.contrib.auth', |
| 64 | + 'django.contrib.contenttypes', |
| 65 | + 'django.contrib.sessions', |
| 66 | + 'django.contrib.messages', |
| 67 | + 'django.contrib.staticfiles', |
| 68 | + |
| 69 | + 'steepshot_io.core', |
| 70 | +] |
| 71 | + |
| 72 | +MIDDLEWARE = [ |
| 73 | + 'django.middleware.security.SecurityMiddleware', |
| 74 | + 'django.contrib.sessions.middleware.SessionMiddleware', |
| 75 | + 'django.middleware.common.CommonMiddleware', |
| 76 | + 'django.middleware.csrf.CsrfViewMiddleware', |
| 77 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 78 | + 'django.contrib.messages.middleware.MessageMiddleware', |
| 79 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 80 | +] |
| 81 | + |
| 82 | +ROOT_URLCONF = 'steepshot_io.config.urls' |
| 83 | + |
| 84 | +TEMPLATES = [ |
| 85 | + { |
| 86 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 87 | + 'DIRS': [ |
| 88 | + os.path.join(PROJECT_PATH, 'templates'), |
| 89 | + ], |
| 90 | + 'APP_DIRS': True, |
| 91 | + 'OPTIONS': { |
| 92 | + 'debug': DEBUG, |
| 93 | + 'context_processors': [ |
| 94 | + 'django.template.context_processors.debug', |
| 95 | + 'django.template.context_processors.i18n', |
| 96 | + 'django.template.context_processors.media', |
| 97 | + 'django.template.context_processors.static', |
| 98 | + 'django.template.context_processors.request', |
| 99 | + 'django.template.context_processors.tz', |
| 100 | + 'django.template.context_processors.request', |
| 101 | + 'django.contrib.auth.context_processors.auth', |
| 102 | + 'django.contrib.messages.context_processors.messages', |
| 103 | + ], |
| 104 | + }, |
| 105 | + }, |
| 106 | +] |
| 107 | + |
| 108 | +WSGI_APPLICATION = 'steepshot_io.config.wsgi.application' |
| 109 | + |
| 110 | + |
| 111 | +# Database |
| 112 | +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases |
| 113 | + |
| 114 | +DATABASES = { |
| 115 | + 'default': dj_database_url.config() |
| 116 | +} |
| 117 | +DATABASES['default']['ATOMIC_REQUESTS'] = True |
| 118 | + |
| 119 | + |
| 120 | +# Password validation |
| 121 | +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators |
| 122 | + |
| 123 | +AUTH_PASSWORD_VALIDATORS = [ |
| 124 | + { |
| 125 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 126 | + }, |
| 127 | + { |
| 128 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 129 | + }, |
| 130 | + { |
| 131 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 132 | + }, |
| 133 | + { |
| 134 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 135 | + }, |
| 136 | +] |
| 137 | + |
| 138 | +USE_REDIS = True |
| 139 | +if USE_REDIS: |
| 140 | + BROKER_URL = 'redis://localhost:6379/0' |
| 141 | + CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' |
| 142 | +else: |
| 143 | + BROKER_URL = 'django://' |
| 144 | +# Safe serializer settings |
| 145 | +CELERY_ACCEPT_CONTENT = ['json'] |
| 146 | +CELERY_TASK_SERIALIZER = 'json' |
| 147 | +CELERY_RESULT_SERIALIZER = 'json' |
| 148 | + |
| 149 | +# Internationalization |
| 150 | +# https://docs.djangoproject.com/en/1.11/topics/i18n/ |
| 151 | + |
| 152 | +LANGUAGE_CODE = 'en-us' |
| 153 | + |
| 154 | +TIME_ZONE = 'UTC' |
| 155 | + |
| 156 | +USE_I18N = True |
| 157 | + |
| 158 | +USE_L10N = True |
| 159 | + |
| 160 | +USE_TZ = True |
| 161 | + |
| 162 | +INTERNAL_IPS = ( |
| 163 | + '0.0.0.0', |
| 164 | + '127.0.0.1', |
| 165 | +) |
| 166 | + |
| 167 | +MEDIA_ROOT = os.path.join(PROJECT_PATH, 'uploads') |
| 168 | +MEDIA_URL = '/uploads/' |
| 169 | + |
| 170 | +# Static files (CSS, JavaScript, Images) |
| 171 | +# https://docs.djangoproject.com/en/1.11/howto/static-files/ |
| 172 | + |
| 173 | +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') |
| 174 | +STATIC_URL = '/static/' |
| 175 | + |
| 176 | +STATICFILES_DIRS = ( |
| 177 | + os.path.join(PROJECT_PATH, 'static'), |
| 178 | +) |
| 179 | + |
| 180 | +ADMIN_URL = r'^djadmin/' |
0 commit comments