3๐
โ
try to edit your Dockerfile like this:
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
and remove command: python manage.py runserver 0.0.0.0:8000
from compose
I assumed that the manage.py
is in /code/
folder, since you have WORKDIR /code
in the dockerfile
then the server will be created in the build stage and the files will be copied to it
๐คLinPy
1๐
as error states โ manage.py
is not in that directory.
And as far as I can see you are copying requirements.txt
twice.
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
# move following line above 'pip install' and make sure that `manage.py` exists on the same directory as `requirements.txt`
COPY . /code/
# remove following line
# COPY requirements.txt /code/
RUN pip install -r requirements.txt
# you can define CMD here, but for dev env it is much more convenient to define it on docker-compose.yml, so you do not need to rebuild the image in case of some changes of the COMMAND
๐คThe Hog
- [Django]-How come Django doesn't email me errors when my DEBUG = False?
- [Django]-Django comment moderation error: AlreadyModerated at /
- [Django]-Run Django commands on Elastic Beanstalk SSH -> Missing environment variables
- [Django]-How to start new web app in Spyder IDE using Django REST framework
- [Django]-Django smart selects on Django version 3.0.1 โ error ImportError: cannot import name 'six' from 'django.utils'
Source:stackexchange.com