• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

gcivil-nyu-org / team1-wed-fall25 / 95

30 Oct 2025 04:04AM UTC coverage: 84.321% (+6.5%) from 77.84%
95

push

travis-pro

web-flow
Merge pull request #89 from gcivil-nyu-org/develop

Merge latest from develop into main

263 of 375 new or added lines in 11 files covered. (70.13%)

6 existing lines in 2 files now uncovered.

1366 of 1620 relevant lines covered (84.32%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.77
/core/settings.py
1
"""
2
Django settings for artinerary project.
3

4
Generated by 'django-admin startproject' using Django 5.2.7.
5

6
For more information on this file, see
7
https://docs.djangoproject.com/en/5.2/topics/settings/
8

9
For the full list of settings and their values, see
10
https://docs.djangoproject.com/en/5.2/ref/settings/
11
"""
12

13
from pathlib import Path
1✔
14
from dotenv import load_dotenv
1✔
15
import os
1✔
16
import sys
1✔
17

18
load_dotenv()
1✔
19

20
# Build paths inside the project like this: BASE_DIR / 'subdir'.
21
BASE_DIR = Path(__file__).resolve().parent.parent
1✔
22

23

24
# Quick-start development settings - unsuitable for production
25
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
26

27
# SECURITY WARNING: keep the secret key used in production secret!
28
SECRET_KEY = os.environ.get("SECRET_KEY")
1✔
29
SECRET_KEY_FALLBACKS = [
1✔
30
    os.environ.get("SECRET_KEY_FALLBACK"),
31
]
32

33
# SECURITY WARNING: don't run with debug turned on in production!
34
DEBUG = os.environ.get("DEBUG")
1✔
35

36
ALLOWED_HOSTS = [
1✔
37
    "127.0.0.1",
38
    "172.31.41.137",
39
    "artinerary-dev.us-east-2.elasticbeanstalk.com",
40
    "artinerary-prod.us-east-2.elasticbeanstalk.com",
41
    "localhost",
42
    ".elasticbeanstalk.com",
43
]
44

45

46
# Application definition
47

48
INSTALLED_APPS = [
1✔
49
    "django.contrib.admin",
50
    "django.contrib.auth",
51
    "django.contrib.contenttypes",
52
    "django.contrib.sessions",
53
    "django.contrib.messages",
54
    "django.contrib.staticfiles",
55
    "accounts",
56
    "events.apps.EventsConfig",
57
    "loc_detail",
58
    "itineraries.apps.ItinerariesConfig",
59
    "storages",
60
    "user_profile.apps.UserProfileConfig",
61
]
62

63
MIDDLEWARE = [
1✔
64
    "django.middleware.security.SecurityMiddleware",
65
    "django.contrib.sessions.middleware.SessionMiddleware",
66
    "django.middleware.common.CommonMiddleware",
67
    "django.middleware.csrf.CsrfViewMiddleware",
68
    "django.contrib.auth.middleware.AuthenticationMiddleware",
69
    "django.contrib.messages.middleware.MessageMiddleware",
70
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
71
]
72

73
ROOT_URLCONF = "core.urls"
1✔
74

75
TEMPLATES = [
1✔
76
    {
77
        "BACKEND": "django.template.backends.django.DjangoTemplates",
78
        "DIRS": [BASE_DIR / "templates"],
79
        "APP_DIRS": True,
80
        "OPTIONS": {
81
            "context_processors": [
82
                "django.template.context_processors.request",
83
                "django.contrib.auth.context_processors.auth",
84
                "django.contrib.messages.context_processors.messages",
85
            ],
86
        },
87
    },
88
]
89

90
WSGI_APPLICATION = "core.wsgi.application"
1✔
91

92

93
# Database
94
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
95

96
if "test" in sys.argv or os.environ.get("TRAVIS") == "true":
1✔
97
    DATABASES = {
1✔
98
        "default": {
99
            "ENGINE": "django.db.backends.sqlite3",
100
            "NAME": ":memory:",
101
        }
102
    }
103
elif "RDS_DB_NAME" in os.environ:
×
104
    DATABASES = {
×
105
        "default": {
106
            "ENGINE": "django.db.backends.postgresql",
107
            "NAME": os.environ.get("RDS_DB_NAME"),
108
            "USER": os.environ.get("RDS_USERNAME"),
109
            "PASSWORD": os.environ.get("RDS_PASSWORD"),
110
            "HOST": os.environ.get("RDS_HOSTNAME"),
111
            "PORT": os.environ.get("RDS_PORT", 5432),
112
        }
113
    }
NEW
114
elif os.environ.get("DB_NAME"):
×
UNCOV
115
    DATABASES = {
×
116
        "default": {
117
            "ENGINE": "django.db.backends.postgresql",
118
            "NAME": os.environ.get("DB_NAME"),
119
            "USER": os.environ.get("DB_USER"),
120
            "PASSWORD": os.environ.get("DB_PASSWORD"),
121
            "HOST": "localhost",  # Or the IP address/hostname of your PostgreSQL server
122
            "PORT": "5432",  # Default PostgreSQL port
123
        }
124
    }
125
else:
126
    # Use SQLite as fallback for local development
NEW
127
    DATABASES = {
×
128
        "default": {
129
            "ENGINE": "django.db.backends.sqlite3",
130
            "NAME": BASE_DIR / "db.sqlite3",
131
        }
132
    }
133

134

135
# aws settings
136
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID")
1✔
137
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY")
1✔
138
AWS_STORAGE_BUCKET_NAME = os.environ.get("AWS_STORAGE_BUCKET_NAME")
1✔
139
AWS_S3_REGION_NAME = "us-east-2"
1✔
140
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"
1✔
141
AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
1✔
142

143
# static and media file settings
144
STATIC_ROOT = BASE_DIR / "staticfiles"
1✔
145
STATICFILES_DIRS = [
1✔
146
    os.path.join(BASE_DIR, "static"),
147
]
148

149
MEDIA_ROOT = BASE_DIR / "media"
1✔
150
STATICFILES_LOCATION = "static"
1✔
151
MEDIAFILES_LOCATION = "media"
1✔
152
MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{MEDIAFILES_LOCATION}/"
1✔
153

154
# Use local static files if local, use static files in S3 otherwise
155
# Use S3 media files all the time
156
# Use local file storage for tests to avoid boto3 dependency
157
if "test" in sys.argv or os.environ.get("TRAVIS") == "true":
1✔
158
    STATIC_URL = "static/"
1✔
159
    MEDIA_URL = "media/"
1✔
160
    STORAGES = {
1✔
161
        "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
162
        "staticfiles": {
163
            "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"
164
        },
165
    }
NEW
166
elif DEBUG:
×
UNCOV
167
    STATIC_URL = "static/"
×
UNCOV
168
    STORAGES = {
×
169
        "default": {"BACKEND": "core.custom_storage.MediaStorage"},
170
        "staticfiles": {
171
            "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"
172
        },
173
    }
174
else:
175
    STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{STATICFILES_LOCATION}/"
×
176
    STORAGES = {
×
177
        "default": {"BACKEND": "core.custom_storage.MediaStorage"},
178
        "staticfiles": {"BACKEND": "core.custom_storage.StaticStorage"},
179
    }
180

181

182
# Password validation
183
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
184

185
AUTH_PASSWORD_VALIDATORS = [
186
    {
187
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",  # noqa: E501
188
    },
189
    {
190
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
191
    },
192
    {
193
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
194
    },
195
    {
196
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
197
    },
198
]
199

200

201
# Internationalization
202
# https://docs.djangoproject.com/en/5.2/topics/i18n/
203

204
LANGUAGE_CODE = "en-us"
1✔
205

206
TIME_ZONE = "UTC"
1✔
207

208
USE_I18N = True
1✔
209

210
USE_TZ = True
1✔
211

212
# Default primary key field type
213
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
214

215
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
1✔
216

217
# Authentication
218
AUTHENTICATION_BACKENDS = [
1✔
219
    "accounts.auth_backends.EmailOrUsernameModelBackend",
220
    "django.contrib.auth.backends.ModelBackend",
221
]
222

223
LOGIN_REDIRECT_URL = "/artinerary/"
1✔
224
LOGOUT_REDIRECT_URL = "/accounts/login/"
1✔
225
LOGIN_URL = "/accounts/login/"
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc