mechanism to reload modules ?

4 views
Skip to first unread message

northof40

unread,
Apr 19, 2006, 6:09:45 PM4/19/06
to cherrypy-users
Hi - If my understanding is correct when the CP server starts it
'compiles' all the relevant modules to pyc and uses that code until the
server stops. As a result changes to the underlying .py's are not
reflected until the server stops. In our case we use kid templates
which also get compiled to pyc's.

Is there a way to tell CP to reload all modules without stopping and
starting ?

The reason i ask is that i have a person doing CSS/HTML work on the
templates who could get by with just FTP access if there was a means of
reloading the modules without shell access.

regards

richard.

Mathieu Rouleau

unread,
Apr 19, 2006, 7:46:31 PM4/19/06
to cherryp...@googlegroups.com
cp has an autoreload feature that is enabled by default (in development environment at least)
if you modify .py files while the server is running it should automatically shutdown and restart
(it works quite well too)

this feature is usually disabled when running in production because it can consume system
resources needlessly

your alternative then is to manually shutdown and reload the server, but maybe there is a way of doing that from code and I just don't know of it yet

d

Robert Brewer

unread,
Apr 19, 2006, 11:35:11 PM4/19/06
to cherryp...@googlegroups.com

Mathieu Rouleau wrote:
> your alternative then is to manually shutdown
> and reload the server, but maybe there is a way
> of doing that from code and I just don't know
> of it yet

cherrypy.server.restart() often works (depending on your deployment setup).


Robert Brewer
System Architect
Amor Ministries
fuma...@amor.org

Reply all
Reply to author
Forward
0 new messages