dockerizing-django icon indicating copy to clipboard operation
dockerizing-django copied to clipboard

Not changing code before run unit tests

Open gilsondev opened this issue 9 years ago • 7 comments

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?

gilsondev avatar May 12 '16 13:05 gilsondev

Can you post the Github link to your code?

Sent from my iPhone

On May 12, 2016, at 7:32 AM, Gilson Filho [email protected] 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

mjhea0 avatar May 12 '16 14:05 mjhea0

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

FingerLiu avatar May 16 '16 01:05 FingerLiu

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

mjhea0 avatar May 16 '16 13:05 mjhea0

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

dukebody avatar May 17 '16 13:05 dukebody

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

mjhea0 avatar May 17 '16 13:05 mjhea0

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

FingerLiu avatar May 20 '16 03:05 FingerLiu

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

slyapustin avatar Jul 21 '16 19:07 slyapustin