|
30 | 30 |
|
31 | 31 | # Application definition
|
32 | 32 | INSTALLED_APPS = [
|
| 33 | + "whitenoise.runserver_nostatic", |
| 34 | + 'django_crontab', |
33 | 35 | 'django.contrib.admin',
|
34 | 36 | 'django.contrib.auth',
|
35 | 37 | 'django.contrib.contenttypes',
|
|
57 | 59 | 'corsheaders',
|
58 | 60 | ]
|
59 | 61 |
|
60 |
| -GOOGLE_WALLET_ENABLED=True #Set to false to disable google wallet |
| 62 | +GOOGLE_WALLET_ENABLED = False # Set to false to disable google wallet |
61 | 63 |
|
62 | 64 | if BAGGAGE_ENABLED:
|
63 | 65 | INSTALLED_APPS.append('baggage')
|
|
79 | 81 | 'django.middleware.security.SecurityMiddleware',
|
80 | 82 | 'django.contrib.sessions.middleware.SessionMiddleware',
|
81 | 83 | "corsheaders.middleware.CorsMiddleware",
|
| 84 | + "whitenoise.middleware.WhiteNoiseMiddleware", |
82 | 85 | 'django.middleware.common.CommonMiddleware',
|
83 | 86 | 'django.middleware.csrf.CsrfViewMiddleware',
|
84 | 87 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
126 | 129 | ssl_require=os.environ.get('DATABASE_SECURE', 'true').lower() != 'false',
|
127 | 130 | )
|
128 | 131 |
|
129 |
| -if os.environ.get('PG_PWD', None): |
| 132 | +if os.environ.get('POSTGRES_PASSWORD', None): |
130 | 133 | DATABASES = {
|
131 | 134 | 'default': {
|
132 | 135 | 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
133 |
| - 'NAME': os.environ.get('PG_NAME', 'backend'), |
134 |
| - 'USER': os.environ.get('PG_USER', 'backenduser'), |
135 |
| - 'PASSWORD': os.environ.get('PG_PWD'), |
136 |
| - 'HOST': os.environ.get('PG_HOST', 'localhost'), |
| 136 | + 'NAME': os.environ.get('POSTGRES_DB', 'backend'), |
| 137 | + 'USER': os.environ.get('POSTGRES_USER', 'backenduser'), |
| 138 | + 'PASSWORD': os.environ.get('POSTGRES_PASSWORD'), |
| 139 | + 'HOST': os.environ.get('POSTGRES_HOST', 'localhost'), |
137 | 140 | 'PORT': '5432',
|
138 | 141 | }
|
139 | 142 | }
|
|
191 | 194 | STATICFILES_DIRS = [
|
192 | 195 | os.path.join(BASE_DIR, os.path.join('app', "static")),
|
193 | 196 | ]
|
194 |
| -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' |
| 197 | +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' |
195 | 198 |
|
196 | 199 | # Dev emails set up
|
197 | 200 | if os.environ.get('ADMIN_EMAIL', None):
|
198 | 201 | try:
|
199 | 202 | HACKATHON_DEV_EMAILS.append(os.environ['ADMIN_EMAIL'])
|
200 | 203 | except NameError:
|
201 |
| - HACKATHON_DEV_EMAILS = [os.environ['ADMIN_EMAIL'],] |
| 204 | + HACKATHON_DEV_EMAILS = [os.environ['ADMIN_EMAIL'], ] |
202 | 205 |
|
203 | 206 | # File upload configuration
|
204 | 207 | MEDIA_ROOT = 'files'
|
|
292 | 295 | MAX_VOTES_TO_APP = 30
|
293 | 296 |
|
294 | 297 | APPLICATION_EXPIRATION_TYPES = {
|
295 |
| - 'H': True, # Hacker allways expire, do not change this |
296 |
| - 'M': MENTOR_EXPIRES, # Mentor can expire |
297 |
| - 'V': VOLUNTEER_EXPIRES, # Volunteer can expire |
| 298 | + 'H': True, # Hacker allways expire, do not change this |
| 299 | + 'M': MENTOR_EXPIRES, # Mentor can expire |
| 300 | + 'V': VOLUNTEER_EXPIRES, # Volunteer can expire |
298 | 301 | }
|
299 | 302 |
|
300 | 303 | MEALS_TOKEN = os.environ.get('MEALS_TOKEN', None)
|
|
324 | 327 | # Security
|
325 | 328 | SESSION_COOKIE_SECURE = CSRF_COOKIE_SECURE = not DEBUG
|
326 | 329 | SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"
|
| 330 | + |
| 331 | +# Cron configuration to expire invitations and reimbursements |
| 332 | +CRONJOBS = [ |
| 333 | + ('6 */2 * * *', 'django.core.management.call_command', ['expire_reimbursements']), |
| 334 | + ('6 */2 * * *', 'django.core.management.call_command', ['expire_applications']), |
| 335 | +] |
0 commit comments