Add database config

This commit is contained in:
Daoud Clarke 2023-10-26 17:32:46 +01:00
parent 911b243239
commit 36ec3ae4e5
5 changed files with 34 additions and 12 deletions

View file

@ -72,17 +72,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'mwmbl.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

View file

@ -1,5 +1,14 @@
from mwmbl.settings_common import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
DEBUG = True
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]

View file

@ -1,5 +1,12 @@
import os
import dj_database_url
from mwmbl.settings_common import *
DATABASES = {'default': dj_database_url.config(default=os.environ["DATABASE_URL"])}
DEBUG = False
ALLOWED_HOSTS = ["api.mwmbl.org", "mwmbl.org"]

18
poetry.lock generated
View file

@ -520,6 +520,22 @@ files = [
{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},
]
[[package]]
name = "dj-database-url"
version = "2.1.0"
description = "Use Database URLs in your Django Application."
category = "main"
optional = false
python-versions = "*"
files = [
{file = "dj-database-url-2.1.0.tar.gz", hash = "sha256:f2042cefe1086e539c9da39fad5ad7f61173bf79665e69bf7e4de55fa88b135f"},
{file = "dj_database_url-2.1.0-py3-none-any.whl", hash = "sha256:04bc34b248d4c21aaa13e4ab419ae6575ef5f10f3df735ce7da97722caa356e0"},
]
[package.dependencies]
Django = ">=3.2"
typing-extensions = ">=3.10.0.0"
[[package]]
name = "django"
version = "4.2.6"
@ -2599,4 +2615,4 @@ indexer = ["ujson", "warcio", "idna", "beautifulsoup4", "lxml", "langdetect", "p
[metadata]
lock-version = "2.0"
python-versions = ">=3.10,<3.11"
content-hash = "13572a7df206102ce30a6deb1eecd22b5b217a96f864a7dd6c558a7ca263d520"
content-hash = "37c79d582b976c81d731ea9bac38911f8cf578ae72fe715e23ab7d1236712f81"

View file

@ -38,6 +38,7 @@ django-ninja = "^0.22.2"
requests-cache = "^1.1.0"
redis = {extras = ["hiredis"], version = "^5.0.1"}
django-allauth = "^0.57.0"
dj-database-url = "^2.1.0"
[tool.poetry.extras]
indexer = [