changes to .py file is not reflected until server is restarted.

329 views
Skip to first unread message

vijaymohan

unread,
Sep 21, 2011, 12:13:13 PM9/21/11
to Django users
I am new to django and did't find solution googling. i changed a .py
file in my app and hit refresh button on web browser but the changes
are not reflected until i restart the httpd. is there any flag i need
to set this to happen.

I set PythonAutoReload On in python.conf.
Changes to template file are reflecting but not the .py files.

Can someone help me ?

Thanks,
Vijay

Cal Leeming [Simplicity Media Ltd]

unread,
Sep 21, 2011, 12:36:20 PM9/21/11
to django...@googlegroups.com
Hi Vijay,

Some web app servers will allow you to 'touch' the wrapper file (wsgi.py for example) which will in turn trigger a restart. Running manage.py in 'runserver' mode will also do this (this is for dev, NOT for production).

But for the most part, production will require you to restart the webapp service in order to recognise changes (an exception being Apache, which allows the 'touch' approach).

Hope this helps

Cal


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


vijaymohan

unread,
Sep 21, 2011, 12:58:45 PM9/21/11
to django...@googlegroups.com
i am using Apache, touch approach is not working for me.Is there any change i need to make in httpd.conf ? 

Cal Leeming [Simplicity Media Ltd]

unread,
Sep 21, 2011, 1:00:13 PM9/21/11
to django...@googlegroups.com
May I ask which file you are attempting to 'touch'? You can only do it on the bootstrapper.

Cal

On Wed, Sep 21, 2011 at 5:58 PM, vijaymohan <vijaym...@gmail.com> wrote:
i am using Apache, touch approach is not working for me.Is there any change i need to make in httpd.conf ? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2woUQpBtcVIJ.

vijaymohan

unread,
Sep 21, 2011, 1:24:20 PM9/21/11
to django...@googlegroups.com
[vijay]$ cd /var/www/html/mysite/
[vijay mysite]$ ls
__init__.py  manage.py  settings.py  templates  urls.py  views.py

modified views.py file.

Cal Leeming [Simplicity Media Ltd]

unread,
Sep 21, 2011, 1:25:09 PM9/21/11
to django...@googlegroups.com
Yeah that won't work.

You need to 'touch' your bootstrapper.

Cal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZHZIP-0A3sEJ.

vijaymohan

unread,
Sep 21, 2011, 1:44:59 PM9/21/11
to django...@googlegroups.com
i am in very early stage of learning django. if you don't mind could you tell me what the bootstrapper is ?

Cal Leeming [Simplicity Media Ltd]

unread,
Sep 21, 2011, 1:48:57 PM9/21/11
to django...@googlegroups.com
Sorry, I should have been more clear on this.

In your apache config, you should have specified a WSGI file to attach to (assuming you are using WSGI) - this is the file you need to touch.

If not, please specify how you are telling Apache to connect to your python app.

Cal



On Wed, Sep 21, 2011 at 6:44 PM, vijaymohan <vijaym...@gmail.com> wrote:
i am in very early stage of learning django. if you don't mind could you tell me what the bootstrapper is ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/98ZrsVwVYGUJ.

vijaymohan

unread,
Sep 21, 2011, 2:25:08 PM9/21/11
to django...@googlegroups.com
i did't modify httpd.conf
i just included the below line in /etc/httpd/conf.d/python.conf

LoadModule python_module modules/mod_python.so

<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonOption django.root /mysite
    PythonDebug On
    PythonAutoReload On
    PythonPath "['/var/www/html'] + sys.path"
</Location>


and  mysite directory i have the below files
__init__.py  manage.py  settings.py  templates  urls.py  views.py


so, which file should i touch ?

Cal Leeming [Simplicity Media Ltd]

unread,
Sep 21, 2011, 2:37:53 PM9/21/11
to django...@googlegroups.com
Oh jeez - modpython, I've nfi how to make that work with the same approach. Maybe check mod_python docs??

Cal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ifGSAsCZWlUJ.

Daniel Roseman

unread,
Sep 21, 2011, 2:54:29 PM9/21/11
to django...@googlegroups.com
Firstly, mod_python is deprecated. Don't use it. Use mod_wsgi instead for production.

Secondly, for development, don't use Apache. Use the built-in runserver. That's what it's for.
--
DR.

kenneth gonsalves

unread,
Sep 22, 2011, 2:02:31 AM9/22/11
to django...@googlegroups.com
On Wed, 2011-09-21 at 19:37 +0100, Cal Leeming [Simplicity Media Ltd]
wrote:

> Oh jeez - modpython, I've nfi how to make that work with the same
> approach. Maybe check mod_python docs??

apachectl graceful - no other way.
--
regards
Kenneth Gonsalves

Thomas Orozco

unread,
Sep 22, 2011, 5:43:53 AM9/22/11
to django...@googlegroups.com

Sightly off topic, but your .py files seem to be exposed by your webserver - you shouldn't do this or anyone could download them!

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
Reply all
Reply to author
Forward
0 new messages