Reputation: 1
I am just a beginner at this
So when I run
sudo docker-compose run web python manage.py runserver
it shows
Starting thirddj_db_1 ... done
usr/local/lib/python3.6/site-packages/psycopg2/__init__.py:144:
UserWarning: The psycopg2 wheel package will be renamed from release
2.8; in order to keep installing from binary please use "pip install
psycopg2-binary" instead. For details see:
<http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py:144:
UserWarning: The psycopg2 wheel package will be renamed from release
2.8; in order to keep installing from binary please use "pip install
psycopg2-binary" instead. For details see:
<http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
Performing system checks...
System check identified no issues (0 silenced).
April 11, 2018 - 19:15:59
Django version 1.11.12, using settings 'composeexample.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
And then when I opened it in my browser, it shows the site cant be reached
But when i run
docker-compose up
it shows
web_1 | /usr/local/lib/python3.6/site-
packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel
package will be renamed from release 2.8; in order to keep installing
from binary please use "pip install psycopg2-binary" instead. For
details see: <http://initd.org/psycopg/docs/install.html#binary-
install-from-pypi>.
web_1 | """)
web_1 | /usr/local/lib/python3.6/site-
packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel
package will be renamed from release 2.8; in order to keep installing
from binary please use "pip install psycopg2-binary" instead. For
details see: <http://initd.org/psycopg/docs/install.html#binary-
install-from-pypi>.
web_1 | """)
web_1 | Performing system checks...
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 | April 11, 2018 - 19:21:41
web_1 | Django version 1.11.12, using settings
'composeexample.settings'
web_1 | Starting development server at http://0.0.0.0:8000/
web_1 | Quit the server with CONTROL-C.
And then when I opened it in my browser, it works
so i want to know Why sudo docker-compose run web python manage.py runserver is not working and what is the difference between both commands.
and here is my docker-compose file
version: '3'
services:
db:
image: postgres
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
Upvotes: 0
Views: 2362
Reputation: 618
When you run the web container it's necessary run command with the service's ports enabled and mapped to the host.
Try this:
sudo docker-compose run --service-ports web python manage.py runserver
Upvotes: 2