Django with uwsgi not service static files
I am running a django app using uwsgi and docker. When i open the admin panel, it's all messed up. I figured it's because the static files are giving 404. How do i fix this?
uwsgi.ini:
static-map = /static=/app/static
static-expires = /* 7776000
offload-threads = %k
settings.py
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
I have run collectstatic and verified static dir exists in docker container
Dockerfile
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y software-properties-common python3-launchpadlib \
&& add-apt-repository ppa:savoury1/ffmpeg4 \
&& apt-get update \
&& apt-get install -y --no-install-recommends gcc libpq-dev ffmpeg libc-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY Pipfile Pipfile.lock /app/
RUN pip install pipenv && pipenv install --system --deploy
# Copy project files
COPY . /app/
# Expose the port the app runs on
EXPOSE 8000
# Run the Django app
CMD ["uwsgi", "--http", "0.0.0.0:8000", "--module", "yt_automation.wsgi:application", "--ini", "uwsgi.ini"]