3

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.

avatar
  • 12,087
  • 17
  • 66
  • 82

1 Answers1

5

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).

Yuji 'Tomita' Tomita
  • 115,817
  • 29
  • 282
  • 245
  • +1 this is almost certainly the problem. If it's not, make sure you don't have etags misconfigured and are doing a full refresh on the page. – Paul McMillan Jan 24 '11 at 18:54
  • Yuji so you are using the same shell script from the 1st link? – avatar Jan 24 '11 at 19:06
  • @itgorilla No, I'm not using FastCGI, but yes that restart script should work. It's a simple one to follow, run django with `manage.py runfcgi pidfile=mypidfile.pid`, kill it with 'kill `cat /path/to/mypidfile.pid`' – Yuji 'Tomita' Tomita Jan 24 '11 at 19:25
  • thank you for your advise. By the way, Argentinian wines are great :). – avatar Jan 24 '11 at 19:34