Class Autoreloader
source code
object --+
|
SimplePlugin --+
|
Monitor --+
|
Autoreloader
Monitor which re-executes the process when files change.
This :ref:`plugin<plugins>` restarts the process (via
:func:`os.execv`) if any of the files it monitors change (or is deleted).
By default, the autoreloader monitors all imported modules; you can add
to the set by adding to ``autoreload.files``:
cherrypy.engine.autoreload.files.add(myFile)
If there are imported files you do *not* wish to monitor, you can
adjust the ``match`` attribute, a regular expression. For example, to
stop monitoring cherrypy itself:
cherrypy.engine.autoreload.match = r'^(?!cherrypy).+'
Like all :class:`Monitor<cherrypy.process.plugins.Monitor>`
plugins, the autoreload plugin takes a ``frequency`` argument. The
default is 1 second; that is, the autoreloader will examine files once
each second.
|
__init__(self,
bus,
frequency=1,
match=' .* ' )
x.__init__(...) initializes x; see help(type(x)) for signature |
source code
|
|
|
|
|
sysfiles(self)
Return a Set of sys.modules filenames to monitor. |
source code
|
|
|
run(self)
Reload the process if registered files have been modified. |
source code
|
|
Inherited from Monitor :
graceful ,
stop
Inherited from SimplePlugin :
subscribe ,
unsubscribe
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
|
files = None
The set of files to poll for modifications.
|
|
frequency = 1
The interval in seconds at which to poll for modified files.
|
|
match = ' .* '
A regular expression by which to match filenames.
|
Inherited from Monitor :
callback ,
thread
Inherited from SimplePlugin :
bus
|
Inherited from object :
__class__
|
__init__(self,
bus,
frequency=1,
match=' .* ' )
(Constructor)
| source code
|
x.__init__(...) initializes x; see help(type(x)) for signature
- Overrides:
object.__init__
- (inherited documentation)
|
Start our own background task thread for self.run.
- Overrides:
Monitor.start
|