Cannot communicate with server in private network

Traceback: https://pastebin.com/czArL7Rp Django is trying to talk to the database, but cannot connect and is as such throwing a 500
Pastebin
2024-01-14 13:27:46,265 django.request ERROR Internal Server Err...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
25 Replies
Percy
Percy•5mo ago
Project ID: 6ec4e69f-153c-42b1-8399-d4fbd6db04fb
meaniebeanie22
meaniebeanie22•5mo ago
6ec4e69f-153c-42b1-8399-d4fbd6db04fb
Brody
Brody•5mo ago
can you connect to the database locally?
meaniebeanie22
meaniebeanie22•5mo ago
what do you mean? It's a postgres DB hosted in railway in the same project as the django instance
Brody
Brody•5mo ago
connect to the database from your computer
meaniebeanie22
meaniebeanie22•5mo ago
not sure how to do that what I am going to try though is replacing postgres.railway.internal with the public url and seeing if that works works with that so not sure
Brody
Brody•5mo ago
can you add a 3 second sleep to the beginning of your start command when using the internal domain
meaniebeanie22
meaniebeanie22•5mo ago
how would i do that - somewhere in the dockerfile?
Brody
Brody•5mo ago
ah youre using a dockerfile, send it please
meaniebeanie22
meaniebeanie22•5mo ago
FROM python:3.12.1-slim

ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
pkg-config \
libcairo2-dev \
python3-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

# Collect static files
RUN python manage.py collectstatic --noinput

CMD gunicorn tkdmanager.wsgi --log-file -
FROM python:3.12.1-slim

ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
pkg-config \
libcairo2-dev \
python3-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

# Collect static files
RUN python manage.py collectstatic --noinput

CMD gunicorn tkdmanager.wsgi --log-file -
Brody
Brody•5mo ago
looks like something i would write
meaniebeanie22
meaniebeanie22•5mo ago
ya did :}
Brody
Brody•5mo ago
FROM python:3.12.1-slim

ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
pkg-config \
libcairo2-dev \
python3-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

# Collect static files
RUN python manage.py collectstatic --noinput

CMD sleep 3 && gunicorn tkdmanager.wsgi --log-file -
FROM python:3.12.1-slim

ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
pkg-config \
libcairo2-dev \
python3-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

# Collect static files
RUN python manage.py collectstatic --noinput

CMD sleep 3 && gunicorn tkdmanager.wsgi --log-file -
that checks out
meaniebeanie22
meaniebeanie22•5mo ago
and then switch the PGHOST env var back to postgres.railway.internal?
Brody
Brody•5mo ago
yep PGPORT needs to be set to 5432 too
meaniebeanie22
meaniebeanie22•5mo ago
AHH that may have been why
Brody
Brody•5mo ago
its prob both the missing sleep and the wrong port
meaniebeanie22
meaniebeanie22•5mo ago
it was working before without the sleep
Brody
Brody•5mo ago
sleep is a good thing to have
meaniebeanie22
meaniebeanie22•5mo ago
we will see yep Thanks!
Brody
Brody•5mo ago
works?
meaniebeanie22
meaniebeanie22•5mo ago
yes the error is now my python being broke rather than the db and i know how to get it to work if i want
Brody
Brody•5mo ago
if you want lol
meaniebeanie22
meaniebeanie22•5mo ago
this is a hobby project and this one thing that i want to have has refused to work a dozen times but it works okay without it
Brody
Brody•5mo ago
fine by me 😆