Fixed getting creditionals for postgre from env
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
.dockerignore
|
.dockerignore
|
||||||
Dockerfile
|
Dockerfile
|
||||||
README.md
|
README.md
|
||||||
|
ruff.toml
|
||||||
venv/
|
venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
.ruff_cache/
|
||||||
|
|||||||
@@ -158,3 +158,5 @@ cython_debug/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
static/
|
||||||
|
|||||||
@@ -63,12 +63,26 @@ WSGI_APPLICATION = "pulse.wsgi.application"
|
|||||||
|
|
||||||
POSTGRES_CONN = os.getenv("POSTGRES_CONN")
|
POSTGRES_CONN = os.getenv("POSTGRES_CONN")
|
||||||
|
|
||||||
|
POSTGRES_JDBC_URL = os.getenv("POSTGRES_JDBC_URL")
|
||||||
|
|
||||||
|
if POSTGRES_CONN:
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.postgresql",
|
"ENGINE": "django.db.backends.postgresql",
|
||||||
**dj_database_url.parse(POSTGRES_CONN),
|
**dj_database_url.parse(POSTGRES_CONN),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
|
DATABASES = {
|
||||||
|
"default": {
|
||||||
|
"ENGINE": "django.db.backends.postgresql",
|
||||||
|
"NAME": os.getenv("POSTGRES_DATABASE"),
|
||||||
|
"USER": os.getenv("POSTGRES_USERNAME"),
|
||||||
|
"PASSWORD": os.getenv("POSTGRES_PASSWORD"),
|
||||||
|
"HOST": os.getenv("POSTGRES_HOST"),
|
||||||
|
"PORT": os.getenv("POSTGRES_PORT"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
{
|
{
|
||||||
@@ -104,6 +118,8 @@ USE_TZ = True
|
|||||||
|
|
||||||
STATIC_URL = "static/"
|
STATIC_URL = "static/"
|
||||||
|
|
||||||
|
STATIC_ROOT = BASE_DIR / "static"
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
|
|||||||
@@ -3,3 +3,9 @@ SECRET_KEY = secret_key
|
|||||||
DJANGO_ALLOWED_HOSTS = 127.0.0.1
|
DJANGO_ALLOWED_HOSTS = 127.0.0.1
|
||||||
INTERNAL_IPS = 127.0.0.1
|
INTERNAL_IPS = 127.0.0.1
|
||||||
POSTGRES_CONN = postgres://login:pass@localhost:5432/postgres
|
POSTGRES_CONN = postgres://login:pass@localhost:5432/postgres
|
||||||
|
POSTGRES_JDBC_URL = jdbc:postgresql://host:port/dbname
|
||||||
|
POSTGRES_USERNAME = postgres
|
||||||
|
POSTGRES_PASSWORD = password
|
||||||
|
POSTGRES_HOST = localhost
|
||||||
|
POSTGRES_PORT = 5432
|
||||||
|
POSTGRES_DATABASE = postgres
|
||||||
|
|||||||
Reference in New Issue
Block a user