Move sensitive info to .env file and reset db

This commit is contained in:
keannu125 2023-03-10 23:09:20 +08:00
parent 0f317ebbf5
commit 2a9a81d88d
3 changed files with 26 additions and 7 deletions

View file

@ -10,6 +10,7 @@ djoser = "*"
djangorestframework-simplejwt = "*" djangorestframework-simplejwt = "*"
django-cors-headers = "*" django-cors-headers = "*"
django-simple-history = "*" django-simple-history = "*"
python-dotenv = "*"
[dev-packages] [dev-packages]
autopep8 = "*" autopep8 = "*"

10
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "c580f89f813a209d5a47c10bda8969d741b957744084b178bd0a13d6f43e96ea" "sha256": "adf075ae1c44614e471a3fde436359004437d32d0736e88bc3cfc79f626de919"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -390,6 +390,14 @@
"markers": "python_version >= '3.7'", "markers": "python_version >= '3.7'",
"version": "==2.6.0" "version": "==2.6.0"
}, },
"python-dotenv": {
"hashes": [
"sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba",
"sha256:f5971a9226b701070a4bf2c38c89e5a3f0d64de8debda981d1db98583009122a"
],
"index": "pypi",
"version": "==1.0.0"
},
"python3-openid": { "python3-openid": {
"hashes": [ "hashes": [
"sha256:33fbf6928f401e0b790151ed2b5290b02545e8775f982485205a066f874aaeaf", "sha256:33fbf6928f401e0b790151ed2b5290b02545e8775f982485205a066f874aaeaf",

View file

@ -11,6 +11,10 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
""" """
from pathlib import Path from pathlib import Path
from dotenv import load_dotenv
import os
load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -20,8 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-t&s%wwbx-78$qa#&id_+xw8!m3jt35bgukr03e@$v8$-x5q52i' SECRET_KEY = os.environ.get('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
@ -149,10 +152,17 @@ DJOSER = {
}, },
} }
EMAIL_HOST = 'sandbox.smtp.mailtrap.io' # Mailtrap SMTP Testing
EMAIL_HOST_USER = '54ff6949e39105' # EMAIL_HOST = 'sandbox.smtp.mailtrap.io'
EMAIL_HOST_PASSWORD = 'c59d3eaa05f98d' # EMAIL_HOST_USER = '54ff6949e39105'
EMAIL_PORT = '2525' # EMAIL_HOST_PASSWORD = 'c59d3eaa05f98d'
# EMAIL_PORT = '2525'
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = os.environ.get("EMAIL_HOST_USER")
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
EMAIL_PORT = 587
EMAIL_USE_TLS = True
CORS_ALLOWED_ORIGINS = [ CORS_ALLOWED_ORIGINS = [
"http://localhost:3000", "http://localhost:3000",