GDAL
I am wondering how to set GDAL to work with leaflet when deploying a Django project through railway.
Do I need to:
• Include GDAL==3.7.0 in the requirements.txt file
• Set GDAL_LIBRARY_PATH and GEOTS_LIBRARY_PATH in settings.py
• Set these library paths in railway’s variables
• Anything else?
Many thanks for your assistance
Solution:Jump to solution
you need to be using gunicorn, never use runserver on railway
https://docs.railway.app/troubleshoot/fixing-common-errors...
5 Replies
Project ID:
N/A
N/A
Those steps look fine. Have you tested this or are you just speculating?
I am trying to get GDAL installed so I can use geospatial data in the models. I have tried various different versions of GDAL in requirements, dockerfiles containing gdal and libgdal etc. I can't figure out how to get GDAL installed itself in order to be able to set the library paths in .env.
Best I got was the site saying it was deployed with a dockerfile like:
FROM python:3.11.1
RUN apt-get update && apt-get install -y \
gdal-bin \
libgdal-dev \
python3-gdal
ENV GDAL_LIBRARY_PATH /usr/lib/libgdal.so
WORKDIR /app
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app/
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
Logs say site is active but accesing the site returns ServerError and application failed to respond.
Solution
you need to be using gunicorn, never use runserver on railway
https://docs.railway.app/troubleshoot/fixing-common-errors