Fixed getting creditionals for postgre from env
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
README.md
|
||||
ruff.toml
|
||||
venv/
|
||||
__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
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
static/
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ WORKDIR /app
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV SERVER_PORT = 8080
|
||||
ENV DJANGO_DEBUG = False
|
||||
ENV SERVER_PORT=8080
|
||||
ENV DJANGO_DEBUG=False
|
||||
|
||||
RUN pip3 install --upgrade pip
|
||||
COPY requirements/prod.txt .
|
||||
|
||||
@@ -63,12 +63,26 @@ WSGI_APPLICATION = "pulse.wsgi.application"
|
||||
|
||||
POSTGRES_CONN = os.getenv("POSTGRES_CONN")
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
**dj_database_url.parse(POSTGRES_CONN),
|
||||
},
|
||||
}
|
||||
POSTGRES_JDBC_URL = os.getenv("POSTGRES_JDBC_URL")
|
||||
|
||||
if POSTGRES_CONN:
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
**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 = [
|
||||
{
|
||||
@@ -104,6 +118,8 @@ USE_TZ = True
|
||||
|
||||
STATIC_URL = "static/"
|
||||
|
||||
STATIC_ROOT = BASE_DIR / "static"
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
|
||||
@@ -3,3 +3,9 @@ SECRET_KEY = secret_key
|
||||
DJANGO_ALLOWED_HOSTS = 127.0.0.1
|
||||
INTERNAL_IPS = 127.0.0.1
|
||||
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