Skip to content

Commit

Permalink
.env tiedoston luonti ja db määritykset
Browse files Browse the repository at this point in the history
  • Loading branch information
Teemu-Kostamo committed Apr 23, 2024
1 parent 7779eef commit 3cc5570
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions lainatehtailijat/lainatehtailijat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

from pathlib import Path
import os
from dotenv import load_dotenv

load_dotenv()

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -21,7 +24,7 @@
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-h^uzb=vgp#kvb6!ewdfx9nnqjkw&b%ta-wdydpx6th34ni2-f4'
SECRET_KEY = os.getenv('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down Expand Up @@ -81,18 +84,18 @@
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
# "default": {
# "ENGINE": "django.db.backends.mysql",
# "NAME": "LAINATEHDAS_DATABASE",
# "USER": "LAINATEHDAS_USER",
# "PASSWORD": "970577417AbCd!",
# "HOST": "192.168.8.10",
# "PORT": "3307",
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": os.getenv('NAME'),
"USER": os.getenv('USER'),
"PASSWORD": os.getenv('PASSWORD'),
"HOST": os.getenv('HOST'),
"PORT": os.getenv('PORT'),
}
}


Expand Down

0 comments on commit 3cc5570

Please sign in to comment.