From e8615073439cc04c8e881794d4f11601515efde1 Mon Sep 17 00:00:00 2001 From: Artur Borecki Date: Tue, 10 Mar 2026 14:56:24 +0100 Subject: [PATCH] feat(settings/base.py): support GitHub OAuth --- kursy/settings/base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kursy/settings/base.py b/kursy/settings/base.py index eb531fe..5f9cb9e 100644 --- a/kursy/settings/base.py +++ b/kursy/settings/base.py @@ -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"