Add hcaptcha support and .env file

hcaptcha can be turned on in settings.py with parameters in the .env
file

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-07 14:51:26 -07:00
parent fe8ea04d18
commit 6e2c29ae29
4 changed files with 37 additions and 3 deletions

View File

@@ -12,16 +12,19 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
from pathlib import Path
from typing import Sequence
import environ
env = environ.Env()
environ.Env.read_env()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-kxgmmxo@b=75fh!pvsq$w!ure!!*i)2sdr-5^l1o4q^)j)$a=9"
SECRET_KEY = env("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -134,3 +137,10 @@ MEDIA_URL = "media/"
THUMB_SIZE = (200, 200)
MAX_UPLOAD_SIZE = 25 * 1024**2
USE_HCAPTCHA = False
if USE_HCAPTCHA:
INSTALLED_APPS += ["hcaptcha"]
HCAPTCHA_SITEKEY = env("HCAPTCHA_SITEKEY")
HCAPTCHA_SECRET = env("HCAPTCHA_SECRET")