nginx server not reflecting changes

4,319 views
Skip to first unread message

Sandeep kaur

unread,
Jan 11, 2014, 1:39:19 PM1/11/14
to django-users
Hello,
I have deployed my Django site with nginx server, gunicorn and supervisor and it is working fine. But recently I made some changes in settings file of the project and that changes are not visible on the nginx server, however same changes reflect on runserver.
What can be the possible reason for this?

--
Sandeep Kaur
E-Mail: mkaur...@gmail.com
Blog: sandymadaan.wordpress.com



Avraham Serour

unread,
Jan 11, 2014, 1:55:58 PM1/11/14
to django...@googlegroups.com
If I understood you correctly you are saying that when you make changes on settings.py you can see them when running the project from manage.py runserver but not when on production using nginx+gunicorn

When making changes you need to reload the project, runserver autoreloads this is why you can see the changes
you will need to reload gunicorn but not nginx, I'm more familiar with uwsgi but I believe gunicorn have similar options
you can manually reload or set it to autoreload, either when it detects a change in the project folder (wouldn't recommend because of possible log files) or on file touch which I personally use.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF66xG3JpZgwv%3DQ7BDyB8cafOJmRTZRajp7cerLR5JPsfHAmrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Manu

unread,
Jan 12, 2014, 11:18:52 AM1/12/14
to django...@googlegroups.com
Try to reload nginx. 

sudo nginx -s reload

or stop it and restart

sudo nginx -s stop
sudo nginx

if it's still not reflecting those changes, check which settings.py is being used by runserver and the gunicorn. Or, the problem could be that you have to restart gunicorn

sudo supervisorctl restart [gunicorn-program-name]

if you changed media root and static root settings then you have to point nginx to the right location of those assets in nginx site configuration. i.e. in the file that you create inside /etc/nginx/sites-enabled/ for your app. Hope you can resolve it.

Best,

Sandeep kaur

unread,
Jan 14, 2014, 8:34:19 AM1/14/14
to django-users

On Sun, Jan 12, 2014 at 9:48 PM, Manu <manu...@gmail.com> wrote:
>
> Try to reload nginx.
>
>> sudo nginx -s reload
>
>
> or stop it and restart
>
>> sudo nginx -s stop
>> sudo nginx
>
These doesn't make any change.

>
> if it's still not reflecting those changes, check which settings.py is being used by runserver and the gunicorn. Or, the problem could be that you have to restart gunicorn
>
>> sudo supervisorctl restart [gunicorn-program-name]
>

When I use $ps -aux command to see which gunicorn program is running. It shows no job running, but server is nicely configured and is running. I am new to nginx and gunicorn deployment. Though deployment has been done but am not able to understand why the changes are not visible and which program is running which is behind the deployment.
Your help will be highly appreciated.
Thank you.

Manu

unread,
Jan 15, 2014, 1:25:16 PM1/15/14
to django...@googlegroups.com
Please find some of my remarks below


On Tuesday, 14 January 2014 19:04:19 UTC+5:30, sandy wrote:

On Sun, Jan 12, 2014 at 9:48 PM, Manu <manu...@gmail.com> wrote:
>
> Try to reload nginx.
>
>> sudo nginx -s reload
>
>
> or stop it and restart
>
>> sudo nginx -s stop
>> sudo nginx
>
These doesn't make any change.

>
> if it's still not reflecting those changes, check which settings.py is being used by runserver and the gunicorn. Or, the problem could be that you have to restart gunicorn
>
>> sudo supervisorctl restart [gunicorn-program-name]
>


How are you so sure that the server is running? Can you try
$ ps -aux | grep gunicorn
What is it returning to you? 

Amar Kamthe

unread,
Jul 9, 2014, 8:20:51 AM7/9/14
to django...@googlegroups.com
Me too having the same issue.
I tried all the above things like reloading the nginx server and restarting the gunicorn but the changes are not reflected.
Using command ps -aux | grep gunicorn. I found 1 gunicorn master and 3 worker threads running. I my case few of the files are reflecting but few of them don't. Is it that there is an issue with the code files which is not allowing to get loaded in nginx?. Also if I try using shell, it do shows the changed code and all these thing works perfectly with apache and mod wsgi. Can you help me in getting this issue resolved.

Lachlan Musicman

unread,
Jul 9, 2014, 8:29:14 AM7/9/14
to django...@googlegroups.com
Have you tried pycclean?

http://stackoverflow.com/questions/785519/how-do-i-remove-all-pyc-files-from-a-project

ie: find . -name "*.pyc" -exec rm -rf {} \;

then restart gnuicorn/nginx.

cheers
L.
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/949ff45f-20be-47b2-8632-afa88ae3b98b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
-----------------------------------------------------------------------------------------------------------
Adventure Time http://theholenearthecenteroftheworld.com/

Sandeep kaur

unread,
Jul 9, 2014, 12:46:35 PM7/9/14
to django-users

On Wed, Jul 9, 2014 at 5:50 PM, Amar Kamthe <amarka...@gmail.com> wrote:
>
> Me too having the same issue.
> I tried all the above things like reloading the nginx server and restarting the gunicorn but the changes are not reflected.
> Using command ps -aux | grep gunicorn. I found 1 gunicorn master and 3 worker threads running. I my case few of the files are reflecting but few of them don't. Is it that there is an issue with the code files which is not allowing to get loaded in nginx?. Also if I try using shell, it do shows the changed code and all these thing works perfectly with apache and mod wsgi. Can you help me in getting this issue resolved.

Well my issue is resolved. All I do after making the changes is :

$ service supervisord reload
$ service nginx reload

Amar Kamthe

unread,
Jul 9, 2014, 12:48:33 PM7/9/14
to django...@googlegroups.com

Yes tried that out but still not working. I am using python 2.7.2 and django 1.4.1.

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/XK6PA39t81U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages