Home > other >  MAC environment docker django running in the container, modify views. No change after py
MAC environment docker django running in the container, modify views. No change after py

Time:09-27

Environment is a MAC, run a docker container, the container, the execution of python manage. Py runserver then executes 0.0.0.0:8000 to run django, and monitor port 8000,

Docker create containers use command:
Docker run - d - v ~/code:/home/work/code - p 8197:8000 code

So, on the MAC, virtual machine and docker container, at the same time there is a code directory, the code is the same, and the manage of django. Py also inside the code,

When I changed the django's views on the MAC. Py files, virtual machine, a docker container corresponding views. Py file has changed too, says change did come into force in the container,

But the question is, visit the django returned results did not change, or modify the former views. The py rendering, tried to run python manage. Py runserver then executes 0.0.0.0:8000 to revive the django, recreate the containers, container restart, restart the virtual machine, no matter use,

Now you can think of suspected points as follows:
1. The docker caching mechanism, because use the same images, the same mapping directory, etc., so that can be directly from the cache data, so the runtime run directly from the cache code,
2. Django has its own virtual machine or caching mechanism, modified the views. Although py, but not reload,

Pray god to help analyze the really what reason, what's the quick and easy way to solve this problem? Thank you very much ~ ~ ~

CodePudding user response:


When I changed the django's views on the MAC. Py files, virtual machine, a docker container corresponding views. Py file has changed too, says change did come into force in the container,

Changes to commit

  • Related