After changing the view function without runserver again, and press F5 to refresh the page, Django will not reload the new view but use the previous one. but if you change the template, Django always uses the new one.
So, Is there a way to make Django reload the view every time the user refresh the page, I think that is very convenient for develop to modify the view function frequently.
If you are running django using the dev server (./manage.py runserver) then it will always reload when it detects any code changes. This is even more efficient than reloading with every request. If you make a change, it reloads when it needs to.
If you are running a production server (nginx, apache, etc) and you want code-reload, then you need to add something to your wsgi module to detect code changes.
Code reloading with apache: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode
Code reloading with uwsgi: http://projects.unbit.it/uwsgi/wiki/TipsAndTricks
It is a known issue with PyDev. I would suggest running the server from terminal/cmd. cd to your project directory where manage.py is present and run the server using
python manage.py runserver
You don't need to run the project from eclipse menu. Any changes made in eclipse would be reflected as soon as they are made.
If you are running Django as a WSGI application in daemon mode you just need to touch the wsgi.py
for your site and it will reload the application next time there is a request. (So no need for any special options).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With