feat(settings/base.py): support GitHub OAuth

This commit is contained in:
2026-03-10 14:56:24 +01:00
parent 39f1e2912b
commit e861507343

View File

@@ -10,13 +10,19 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/6.0/ref/settings/
"""
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
from pathlib import Path
import dotenv
PROJECT_DIR = Path(__file__).resolve().parent.parent
BASE_DIR = PROJECT_DIR.parent
dotenv.load_dotenv(BASE_DIR / ".env")
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
@@ -49,6 +55,7 @@ INSTALLED_APPS = [
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth.socialaccount.providers.github",
"tailwind",
"theme",
]
@@ -104,6 +111,17 @@ ACCOUNT_SIGNUP_FORM_CLASS = "kursy.forms.SignUpForm"
ACCOUNT_LOGIN_METHODS = ["email", "username"]
SOCIALACCOUNT_PROVIDERS = {
"github": {
"APP": {
"client_id": os.getenv("GITHUB_CLIENT_ID"),
"secret": os.getenv("GITHUB_SECRET"),
},
"SCOPE": [
"read:user",
],
},
}
WSGI_APPLICATION = "kursy.wsgi.application"