realpython / dockerizing-django

https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/
1.34k stars 484 forks source link

Not changing code before run unit tests #26

Open gilsondev opened 8 years ago

gilsondev commented 8 years ago

When I create and run the container, I run the tests to check the result. But when I make a change, it is not reflected and shows the same result. How can he see this change in code?

mjhea0 commented 8 years ago

Can you post the Github link to your code?

Sent from my iPhone

On May 12, 2016, at 7:32 AM, Gilson Filho notifications@github.com wrote:

When I create and run the container, I run the tests to check the result. But when I make a change, it is not reflected and shows the same result. How can he see this change in code?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

FingerLiu commented 8 years ago

Gunicorn does not do auto reload changes in your code by default. You can add param --reload to gunicron, but it is not recommend to do this in prd env, cause it may lead to memory lead.

In my opinion the right way is to stop & rm the container, thne docker-compose build, then docker-compose start

mjhea0 commented 8 years ago

@FingerLiu in development this can be pretty burdensome. Any suggestions?

dukebody commented 8 years ago

I'd say use a volume for local development and runserver instead of gunicorn, so code is reloaded whenever you make a change.

mjhea0 commented 8 years ago

Agreed @dukebody. That's how I set up the compose file.

FingerLiu commented 8 years ago

Maybe in development, runserver is enough, but if a man insist to use gunicorn , he can just simply add --reload to https://github.com/realpython/dockerizing-django/blob/master/docker-compose.yml#L15

as command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000 --reload

slyapustin commented 8 years ago

@gilsondev Did you see updated code inside Docker container? Which version of Docker you use and on which host OS?