Skip to content

Commit

Permalink
Ensure we can run migrations locally. Change default of DEBUG to true…
Browse files Browse the repository at this point in the history
… since we will always have it set as 'false' in prod.
  • Loading branch information
joshSzep committed Jul 22, 2024
1 parent f2c0623 commit 092de33
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 13 additions & 2 deletions hangul_tutor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get("DJANGO_DEBUG", "false").lower() == "true"
DEBUG = os.environ.get("DJANGO_DEBUG", "true").lower() == "true"
IS_NOT_DEBUG = not DEBUG

# HSTS settings
Expand All @@ -51,10 +51,12 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth.socialaccount.providers.google",
"allauth.socialaccount.providers.facebook",
"rest_framework",
"api",
"core",
Expand All @@ -63,6 +65,14 @@
"drf_spectacular_sidecar",
]

SITE_ID = 1

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = "email"
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
LOGIN_REDIRECT_URL = "/"

SOCIALACCOUNT_PROVIDERS = {
"google": {
"APP": {
Expand Down Expand Up @@ -221,7 +231,8 @@
AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by email
# `allauth` specific authentication methods, such as login by email, Facebook, and
# Google login
"allauth.account.auth_backends.AuthenticationBackend",
]

Expand Down
7 changes: 7 additions & 0 deletions local_reset_migrations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Remove the database file if it exists
rm -f db.sqlite3

# Finally, run migrations for all other apps
poetry run python manage.py migrate

0 comments on commit 092de33

Please sign in to comment.