Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django, Nginx, FastCGI caching problem when I change code

I've installed Django, Nginx and FastCGI on one my servers. This is my development server and I'm having a very difficult time with the caching. Every time when I make a change I have to reboot the whole server to see the actual change. Rebooting Nginx process didn't help eithter.

So it might be Django and/or FastCGI doing the caching. I also looked at the settings.py and there is no caching set on Django.

What's the best way to make sure when I change the page code the caching gets reset automatically? Your help is greatly appreciated.

like image 955
avatar Avatar asked Apr 12 '26 21:04

avatar


1 Answers

If it's not manage.py runserver we're talking about, you have to reset your server to see code changes to reload python and your code into memory.

Only the django devlopment server can detect changes and re-boot for you.

If you are saying you have to reboot the machine to update code, then you should look at how to restart your fastcgi process.

http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#stopping-the-fastcgi-daemon
http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#restarting-the-spawned-server

As for the best way? I develop on my local machine so for me a deployment script would ensure I get the latest update from version control and a reboot. Otherwise I just type arestart (a one hand typable bash alias).

like image 180
Yuji 'Tomita' Tomita Avatar answered Apr 15 '26 02:04

Yuji 'Tomita' Tomita