From e4e2e4b30b11afaa48cea0216dc7443d5a6d1d67 Mon Sep 17 00:00:00 2001 From: "Jose A. Tolentino" <61167951+jatolentino@users.noreply.github.com> Date: Mon, 7 Feb 2022 20:01:24 -0500 Subject: [PATCH] Add files via upload --- home/settings/base.py | 101 ++++++++++++++++++++++++++++++++++++++++++ home/settings/dev.py | 22 +++++++++ home/settings/prod.py | 32 +++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 home/settings/base.py create mode 100644 home/settings/dev.py create mode 100644 home/settings/prod.py diff --git a/home/settings/base.py b/home/settings/base.py new file mode 100644 index 0000000..2317667 --- /dev/null +++ b/home/settings/base.py @@ -0,0 +1,101 @@ +import os + +BASE_DIR = os.path.dirname(os.path.dirname( + os.path.dirname(os.path.abspath(__file__)))) +SECRET_KEY = '-05sgp9!deq=q1nltm@^^2cc+v29i(tyybv3v2t77qi66czazj' +DEBUG = True +ALLOWED_HOSTS = [] + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'django.contrib.sites', + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'corsheaders', + 'rest_auth', + 'rest_auth.registration', + 'rest_framework', + 'rest_framework.authtoken', + + 'core' +] + +MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'home.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'build')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +LANGUAGE_CODE = 'en-us' +TIME_ZONE = 'UTC' +USE_I18N = True +USE_L10N = True +USE_TZ = True + +STATIC_URL = '/static/' +MEDIA_URL = '/media/' +STATICFILES_DIRS = [os.path.join(BASE_DIR, 'build/static')] +STATIC_ROOT = os.path.join(BASE_DIR, 'static') +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +SITE_ID = 1 + +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES': ( + 'rest_framework.permissions.IsAuthenticated', + 'rest_framework.permissions.AllowAny', + ), + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.TokenAuthentication', + ), + 'DEFAULT_THROTTLE_CLASSES': ( + 'rest_framework.throttling.ScopedRateThrottle', + 'rest_framework.throttling.AnonRateThrottle', + 'rest_framework.throttling.UserRateThrottle' + ), + 'DEFAULT_THROTTLE_RATES': { + 'demo': '3/day', + 'anon': '24/day', + 'user': '1000/day' + } +} + +CSRF_COOKIE_NAME = "csrftoken" + +AUTH_USER_MODEL = 'core.User' +ACCOUNT_EMAIL_REQUIRED = False +ACCOUNT_AUTHENTICATION_METHOD = 'username' +ACCOUNT_EMAIL_VERIFICATION = 'none' + +# Stripe plan ID + +STRIPE_PLAN_ID = 'facial_monthly_api_call' diff --git a/home/settings/dev.py b/home/settings/dev.py new file mode 100644 index 0000000..41ac0a1 --- /dev/null +++ b/home/settings/dev.py @@ -0,0 +1,22 @@ +'''Use this for development''' + +from .base import * + +ALLOWED_HOSTS += ['localhost'] +DEBUG = True + +WSGI_APPLICATION = 'home.wsgi.dev.application' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + +CORS_ORIGIN_WHITELIST = ( + 'localhost:3000', +) + +STRIPE_PUBLISH_KEY = '' +STRIPE_SECRET_KEY = '' diff --git a/home/settings/prod.py b/home/settings/prod.py new file mode 100644 index 0000000..6058d8d --- /dev/null +++ b/home/settings/prod.py @@ -0,0 +1,32 @@ +'''Use this for production''' + +from .base import * + +DEBUG = False +ALLOWED_HOSTS += ['127.0.0.1'] +WSGI_APPLICATION = 'home.wsgi.prod.application' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': '', + 'USER': '', + 'PASSWORD': '', + 'HOST': 'localhost', + 'PORT': '', + } +} + +AUTH_PASSWORD_VALIDATORS = [ + {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, + {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, + {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, + {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'}, +] + +STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' + +STRIPE_PUBLISH_KEY = '' +STRIPE_SECRET_KEY = '' + +CORS_ORIGIN_ALLOW_ALL = True