简体   繁体   中英

Django don't runserver in docker

I have django project and I want to dockerize it. when I use python manage.py runserver 0.0.0.0:8000 on my system its work: view result picture , but when I try use this command on docker, django server is not running view result picture

This is my Dockerfile that used for build docker image:

FROM python:3.9
ENV PYTHONUNBUFFERED=1
RUN mkdir /app
WORKDIR /app
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY . /app/

I can dockerize project without mysql database(with sqlite) successfully(for test), but i need to connect to this database.

this is my database setting config(in settings.py file):

can anyone help me to find solution?

The Dockerfile is not complete. It misses a line like:

CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM