• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gcivil-nyu-org / fall24-monday-team4 / 412

11 Dec 2024 09:32PM UTC coverage: 97.367% (+0.3%) from 97.063%
412

Pull #167

travis-pro

jeffwong97
Fixed Sign Up UI bug
Pull Request #167: Fixed Sign Up UI bug

2995 of 3076 relevant lines covered (97.37%)

0.97 hits per line

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

98.04
/routepals/settings.py
1
"""
2
Django settings for routepals project.
3

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

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

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

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

17
# Build paths inside the project like this: BASE_DIR / 'subdir'.
18
BASE_DIR = Path(__file__).resolve().parent.parent
1✔
19

20
# Load environment variables from .env file
21
load_dotenv(BASE_DIR / ".env")
1✔
22

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

26
# SECURITY WARNING: keep the secret key used in production secret!
27
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY")
1✔
28

29
# SECURITY WARNING: don't run with debug turned on in production!
30
DEBUG = os.environ.get("DJANGO_DEBUG", "False") == "True"
1✔
31

32
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "*").split(",")
1✔
33

34
# Application definition
35

36
INSTALLED_APPS = [
1✔
37
    "django.contrib.admin",
38
    "django.contrib.auth",
39
    "django.contrib.contenttypes",
40
    "django.contrib.sessions",
41
    "django.contrib.messages",
42
    "django.contrib.staticfiles",
43
    "accounts",
44
    "locations",
45
    "bootstrap5",
46
    "user_profile",
47
    "fontawesomefree",
48
    "chat",
49
]
50

51

52
WSGI_APPLICATION = "routepals.wsgi.application"
1✔
53
ASGI_APPLICATION = "routepals.asgi.application"
1✔
54

55
MIDDLEWARE = [
1✔
56
    "django.middleware.security.SecurityMiddleware",
57
    "django.contrib.sessions.middleware.SessionMiddleware",
58
    "django.middleware.common.CommonMiddleware",
59
    "django.middleware.csrf.CsrfViewMiddleware",
60
    "django.contrib.auth.middleware.AuthenticationMiddleware",
61
    "django.contrib.messages.middleware.MessageMiddleware",
62
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
63
    "utils.security.XSSMiddleware",
64
]
65

66
ROOT_URLCONF = "routepals.urls"
1✔
67

68
TEMPLATES = [
1✔
69
    {
70
        "BACKEND": "django.template.backends.django.DjangoTemplates",
71
        "DIRS": [BASE_DIR / "templates"],
72
        "APP_DIRS": True,
73
        "OPTIONS": {
74
            "context_processors": [
75
                "django.template.context_processors.debug",
76
                "django.template.context_processors.request",
77
                "django.contrib.auth.context_processors.auth",
78
                "django.template.context_processors.tz",
79
                "django.contrib.messages.context_processors.messages",
80
            ],
81
        },
82
    },
83
]
84

85
WSGI_APPLICATION = "routepals.wsgi.application"
1✔
86

87

88
# Database
89
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
90

91
if "RDS_HOSTNAME" in os.environ:
1✔
92
    # AWS Environment
93
    DATABASES = {
×
94
        "default": {
95
            "ENGINE": "django.db.backends.postgresql",
96
            "NAME": os.environ.get("RDS_DB_NAME"),
97
            "USER": os.environ.get("RDS_USERNAME"),
98
            "PASSWORD": os.environ.get("RDS_PASSWORD"),
99
            "HOST": os.environ.get("RDS_HOSTNAME"),
100
            "PORT": os.environ.get("RDS_PORT"),
101
        },
102
    }
103
else:
104
    # Local Environment
105
    DATABASES = {
1✔
106
        "default": {
107
            "ENGINE": "django.db.backends.postgresql",
108
            "NAME": os.environ.get("DB_NAME", "routepals"),
109
            "USER": os.environ.get("DB_USER", "postgres"),
110
            "PASSWORD": os.environ.get("DB_PASSWORD"),
111
            "HOST": os.environ.get("DB_HOST", "localhost"),
112
            "PORT": os.environ.get("DB_PORT", "5432"),
113
        }
114
    }
115

116
# Password validation
117
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
118

119
AUTH_PASSWORD_VALIDATORS = [
1✔
120
    {
121
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
122
    },
123
    {
124
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
125
    },
126
    {
127
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
128
    },
129
    {
130
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
131
    },
132
]
133

134
LOGGING = {
1✔
135
    "version": 1,
136
    "disable_existing_loggers": False,
137
    "formatters": {
138
        "verbose": {
139
            "format": "{levelname} {asctime} {module} {message}",
140
            "style": "{",
141
        },
142
        "simple": {
143
            "format": "{levelname} {message}",
144
            "style": "{",
145
        },
146
    },
147
    "root": {
148
        "handlers": ["console"],
149
        "level": "INFO",
150
    },
151
    "handlers": {
152
        "console": {
153
            "level": "DEBUG",
154
            "class": "logging.StreamHandler",
155
            "formatter": "simple",
156
        },
157
    },
158
    "loggers": {
159
        "django": {
160
            "handlers": ["console"],
161
            "level": "WARNING",
162
            "propagate": True,
163
        },
164
        "user_profile": {
165
            "handlers": ["console"],
166
            "level": "DEBUG",
167
            "propagate": False,
168
        },
169
        "admin_user": {
170
            "handlers": ["console"],
171
            "level": "DEBUG",
172
            "propagate": False,
173
        },
174
    },
175
}
176

177

178
# Internationalization
179
# https://docs.djangoproject.com/en/5.1/topics/i18n/
180

181
LANGUAGE_CODE = "en-us"
1✔
182

183
TIME_ZONE = "America/New_York"  # for NYC
1✔
184
USE_TZ = True
1✔
185

186
USE_I18N = True
1✔
187

188
USE_TZ = True
1✔
189

190

191
# Static files (CSS, JavaScript, Images)
192
STATIC_URL = "/static/"
1✔
193
STATIC_ROOT = "static"
1✔
194
STATICFILES_DIRS = [
1✔
195
    os.path.join(BASE_DIR, "staticfiles"),
196
]
197

198
# Default primary key field type
199
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
200

201
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
1✔
202

203
LOGIN_REDIRECT_URL = "home"
1✔
204
LOGOUT_REDIRECT_URL = "home"
1✔
205

206
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
1✔
207
EMAIL_HOST = "smtp.gmail.com"
1✔
208
EMAIL_PORT = 587
1✔
209
EMAIL_USE_TLS = True
1✔
210
EMAIL_HOST_USER = os.environ.get("EMAIL")
1✔
211
EMAIL_HOST_PASSWORD = os.environ.get("APP_PASSWORD")
1✔
212
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
1✔
213
SITE_URL = os.environ.get("SITE_URL", "http://localhost:8000")
1✔
214

215
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID")
1✔
216
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY")
1✔
217
AWS_STORAGE_BUCKET_NAME = os.environ.get("AWS_STORAGE_BUCKET_NAME")
1✔
218
AWS_S3_REGION_NAME = os.environ.get("AWS_S3_REGION_NAME")
1✔
219

220
PUSHER_APP_ID = os.environ.get("PUSHER_APP_ID")
1✔
221
PUSHER_KEY = os.environ.get("PUSHER_KEY")
1✔
222
PUSHER_SECRET = os.environ.get("PUSHER_SECRET")
1✔
223
PUSHER_CLUSTER = os.environ.get("PUSHER_CLUSTER")
1✔
224

225
ENCRYPTION_KEY = os.environ.get("ENCRYPTION_KEY").encode()
1✔
226

227
SESSION_COOKIE_HTTPONLY = True
1✔
228
SECURE_BROWSER_XSS_FILTER = True
1✔
229
SECURE_CONTENT_TYPE_NOSNIFF = True
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

© 2025 Coveralls, Inc