Hi, I running: Django (trunk)/mod_wsgi (3.3)/Python (2.7) At my work, we can $touch the .wsgi file and that acts like an Apache restart. When I touch the .wsgi file for my project, nothing reloads; I still have to restart Apache in order to see changes. Can I setup my project's .wsgi file to reload my django stuff when I touch it? Thanks so much! Cheers, Micky asked 28 Feb '12, 14:56 mhulse |
According to the mod_wsgi docs, code reloading generally works better when using mod_wsgi in daemon mode. Our Django trunk installer currently sets things up in embedded mode, so if your code isn't reloading, then you're probably bumping into this bit:
We're going to change our Django trunk installer so that it sets things up in daemon mode, so new apps will be easier to work with. I can't say how soon that will happen, so if you want to want to switch to daemon mode now, there are two ways to go about it:
WSGIDaemonProcess your_app processes=2 threads=12 python-path=/home/your_username/webapps/your_app:/home/your_username/webapps/your_app/lib/python2.7 WSGIProcessGroup your_app WSGIRestrictEmbedded On WSGILazyInitialization On I recommend that you take the first option, since that installer will set up Apache with the worker MPM and will be a bit more frugal with RAM usage. Hope that helps! answered 29 Feb '12, 15:47 seanf Thanks Sean! I really appreciate the reply and the infromative infomation. I will test this tonight and get back to you with my results. Thanks! :)
(29 Feb '12, 16:18)
mhulse
I started with a fresh copy of Django 1.3.1 and everything is working perfectly now! Touching my wsgi file is just like a restart. Thanks again Sean and John, you guys rock!
(21 Mar '12, 23:21)
mhulse
|
You should be able to just touch the wsgi file and have changes to python code update. Some simple things to check, Are you using the right .wsgi file? Some projects have more than one located in the deployment directory depending on what was left over from deployment. To double check use the path defined in the apache2/conf/httpd.conf file. Are the changes related to python and the django *.py files or another resource like an external binary or API? You may also submit a support ticket if you would like us to test in real-time. answered 28 Feb '12, 18:05 johns Thank you John! Very helpful! I need to do some testing and I will get back to you asap with my results. Much appreciated!
(29 Feb '12, 00:35)
mhulse
You're welcome.
(29 Feb '12, 00:59)
johns
Hi John, Unfortunately, it appears as though touching my project's wsgi file does not work for me. :( I must have things setup wrong. Would it be helpful for me to post my wsgi/conf files? The type of changes I am looking for are, for example, if I clear my model and do a syncdb (for example). IIRC (from last night) some changes happen instantly (like modifying admin.py), but others changes to django .py files I have to restart (touching does the wsgi does nothing). What would be a good way to test if $ touch is working? Perhaps I'm just doing things that require a full apache restart? I am probably just doing things wrong. :D
(29 Feb '12, 12:52)
mhulse
|