79407547

Date: 2025-02-02 23:53:24
Score: 5
Natty:
Report link

I did not understand what u said about dockerfile actually.

This is my new code and I have this mistake:

FROM python:3.11-slim

RUN apt-get update && apt-get install -y \
    libpq-dev gcc curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /backend

COPY requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY . /backend/

#WORKDIR /backend/project

RUN cd project && ./manage.py collectstatic --noinput

#RUN chown -R www-data:www-data

USER www-data

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH="."
ENV DJANGO_SETTINGS_MODULE=project.settings

EXPOSE 8000

#CMD ["python","manage.py","runserver"]
CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "project.asgi:application"]

and mistake :

ERROR [web 8/9] RUN cd project && ./manage.py collectstatic --noinput                                                                             0.2s 
------
 > [web 8/9] RUN cd project && ./manage.py collectstatic --noinput:
0.211 /bin/sh: 1: ./manage.py: not found
------
failed to solve: process "/bin/sh -c cd project && ./manage.py collectstatic --noinput" did not complete successfully: exit code: 127

My english is not good enought. Can you explain it more basically please ? Thanks.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (2.5): Can you explain
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: whisber