I'm trying to make a simple example of Django app running in docker container.
using this image https://hub.docker.com/_/django/ just for simplicity. Don't tell me please that i shouldn't use it in production :) app is very simple and i'm ok with using very basic Django server.
So, the problem is i'm always getting this error when trying to run the container image
C:\Users\slipo\PycharmProjects\simple_blog>docker run -p 8000:8000 my-blog
python: can't open file './manage.py runserver 0.0.0.0:8000 --settings=mysite.settings.prod': [Errno 2] No such file or directory
however, ./manage.py
and mysite.settings.prod
both definitely existing in container.
container creation log showing the file exists:
Step 7 : RUN ls -a
---> Running in 932ed2ad3e4c
.
..
.idea
Dockerfile
blog
manage.py
mysite
requirements.txt
templates
---> e7f938c1cbf2
Removing intermediate container 932ed2ad3e4c
Step 8 : CMD python ./manage.py runserver 0.0.0.0:8000 --settings=mysite.settings.prod
---> Running in f99bcafbc269
---> aca534e9ccb6
Removing intermediate container f99bcafbc269
Successfully built aca534e9ccb6
Dockerfile:
FROM django
EXPOSE 8000
ADD . /simple_blog
WORKDIR /simple_blog
RUN pip install -r requirements.txt
RUN pip install django-tinymce
RUN ls -a
CMD [ "python", "./manage.py runserver 0.0.0.0:8000 --settings=mysite.settings.prod" ]
Thank you.
can't open file './manage.py runserver 0.0.0.0:8000 --settings=mysite.settings.prod'
This is telling you that it is treating that entire string as a single filename.
I assume something like this works:
CMD [ "python", "./manage.py", "runserver", "0.0.0.0:8000", "--settings=mysite.settings.prod" ]
Try to execute this code.
CMD [ "python", "../manage.py runserver 0.0.0.0:8080 --settings=my_site.settings.prd"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With