Coder Social home page Coder Social logo

Comments (11)

mehtez avatar mehtez commented on August 17, 2024

I have also problems running the commands like in the book. I think there is something mixed up with the folders.

First we have to mkdir /code/hello/ and then he does not tell in the book where to start the Docker commands. Or where to put the Dockerfile. One does not know in which directory he currently is, when he tells to start the commands. There is just the $ sign, absolutely no idea where I am with it.

from djangoforprofessionals.

gschuell avatar gschuell commented on August 17, 2024

from djangoforprofessionals.

mehtez avatar mehtez commented on August 17, 2024

Thanks, I tried a bunch of directories now and it still doesn't work.

After the docker-compose up command it says

Recreating hello_web_1 ... done
Attaching to hello_web_1
web_1 | python: can't open file '/hello/hello_project/manage.py': [Errno 2] No such file or directory
hello_web_1 exited with code 2

No matter how I change the directory it can not find the file. I'm on Windows and don't know how to write down the directory tree right. I tried it also with backslashes, but that doesn't work either.

from djangoforprofessionals.

gregkepler avatar gregkepler commented on August 17, 2024

@mehtez was there anything helpful in the logs?
To see them type: docker-compose logs

from djangoforprofessionals.

Ahmed-ao avatar Ahmed-ao commented on August 17, 2024

when i'm trying to execute commands within docker they never works!, for instance the command
$ docker-compose exec web python manage.py startapp users
from the third chapter in django for professionals.
returns:
CommandError: 'users' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name.!!!
however I changed the app's name to be customers, this time nothing showed up on the screen and no app had been created.!
is anyone of you went through something related?

from djangoforprofessionals.

guyellery avatar guyellery commented on August 17, 2024

Hi,

My issue is similar...
When I run docker-compose up, I get the following:
$ docker-compose up
Recreating hello_web_1 ... done
Attaching to hello_web_1
web_1 | Watching for file changes with StatReloader
web_1 | Performing system checks...
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 | March 29, 2020 - 13:41:35

and it stops at that point. In the book it shows a further 3 lines...
web_1 | Django version 3.0, using settings 'hello_project.settings'
web_1 | Starting development server http://0.0.0.0:8000
web_1 | Quit the server qith CONTROL-C

I DO NOT get those last 3 lines. Consequently, when I run http://0.0.0.0:8000 (I also tried http://127.0.0.1:8000) I get the error message:

This site can’t be reached
0.0.0.1 refused to connect.

Can anyone help?
Regards,
GuyE

from djangoforprofessionals.

stoan avatar stoan commented on August 17, 2024

Hi,

My issue is similar...
When I run docker-compose up, I get the following:
$ docker-compose up
Recreating hello_web_1 ... done
Attaching to hello_web_1
web_1 | Watching for file changes with StatReloader
web_1 | Performing system checks...
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 | March 29, 2020 - 13:41:35

and it stops at that point. In the book it shows a further 3 lines...
web_1 | Django version 3.0, using settings 'hello_project.settings'
web_1 | Starting development server http://0.0.0.0:8000
web_1 | Quit the server qith CONTROL-C

I DO NOT get those last 3 lines. Consequently, when I run http://0.0.0.0:8000 (I also tried http://127.0.0.1:8000) I get the error message:

This site can’t be reached
0.0.0.1 refused to connect.

Can anyone help?
Regards,
GuyE

Did you check your docker logs?

$ docker logs hello_web_1

Docker Logs

from djangoforprofessionals.

guyellery avatar guyellery commented on August 17, 2024

from djangoforprofessionals.

guyellery avatar guyellery commented on August 17, 2024

Hi Siya,

I think I have resolved this (further chapters in the book will prove it). This is what I did...

  1. Delete / Drop everything and start from scratch EXCEPT the initial installation of Docker. Note that this is for Docker Toolbox on Windows 10 Home Edition.
  2. Follow everything exactly from Chapter 1 PP12 through to the end of PP26. Test with docker-compose up and STILL THE SAME ISSUE. CONTROL-C to quit out and run docker-compose down to ensure you are completely out.
  3. Back to PP12 and run this docker run -p 80:80 nginx INSTEAD OF the book code "docker run hello-world". (This seems to link to a different virtual connector - I am going to research this a bit more to understand it better!)
  4. Run this: docker-machine ip default to get the ip address --> 192.168.99.100
  5. Change hello_project.settings.py ALLOWED_HOSTS = [] to ALLOWED_HOSTS = ['*']
  6. Run docker-compose up. This time I GET THE LAST 3 LINES!!!
  7. On the browser, type http://192.168.99.100:8000/ and this returns Hello World!. I tested that it is the right one by changing the text of Hello World and it displayed the new text.
  8. Test again by stopping the Docker service - CONTROL-C / docker-compose down. Web page fails. Re-start with docker-compose up and refresh the web page - Hello World appears.

So I "THINK" this is now working but wherever the book mentions the web page 127.0.0.1:8000 I need to use http://192.168.99.100:8000/ instead.

Please let me know if this is something I SHOULD NOT be doing.

Regards,
GuyE

from djangoforprofessionals.

guyellery avatar guyellery commented on August 17, 2024

Final Update...

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4f7e5a5f3977 hello_web "python /code/manage…" 2 hours ago Up 2 hours 0.0.0.0:8000->8000/tcp hello_web_1
1e48ee26e188 nginx "nginx -g 'daemon of…" 2 hours ago Up 2 hours 0.0.0.0:80->80/tcp jovial_brattain

Shows that the expected "hello_web_1" and new "jovial_brattain" (thats a random generated name) container services are running.

Using docker-compose down ONLY stops the hello_web image. The nginx image is still running. If you want to stop that use the docker stop with a timeout command.

Thanks.
GuyE

from djangoforprofessionals.

Muhammadnadeem123456 avatar Muhammadnadeem123456 commented on August 17, 2024

when i access listview from our main products categories give "Cannot resolve keyword '' into field. Choices are: category, id, image, name"

from djangoforprofessionals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.