Pyjo.Server.Reload.Backend - Auto-restarting development server backend¶
from Pyjo.Server.Reload.Backend import Backend
class Pyjo_Server_Reload_Backend_Inotify(Backend):
def modified_files(self):
...
new = Pyjo_Server_Reload_Backend_Inotify.new
object = Pyjo_Server_Reload_Backend_Inotify
# Or import the module, as in Google Python Style Guide
import Pyjo.Server.Reload.Backend
class Pyjo_Server_Reload_Backend_Inotify(Pyjo.Server.Reload.Backend.object):
def modified_files(self):
...
new = Pyjo_Server_Reload_Backend_Inotify.new
object = Pyjo_Server_Reload_Backend_Inotify
Pyjo.Server.Reload.Backend is an abstract base class for
auto-restarting development server backends used by
Pyjo.Server.Reload.
A backend is a module named Pyjo.Server.Reload.Backend.<Name>, with a
function new that constructs it and the class as object, which
another distribution can add, as pkgutil.extend_path() keeps the
namespace open, and the PYJO_RELOAD_BACKEND environment variable selects
it.
See also¶
Pyjoyment, https://mojolicious.org.
Ported from Mojo::Server::Morbo::Backend of Mojolicious 9.49.
Classes¶
- class Pyjo.Server.Reload.Backend.Pyjo_Server_Reload_Backend(*, watch: list[Any] | None = None, watch_timeout: float | None = None)[source]¶
Pyjo.Server.Reload.Backendinherits all methods fromPyjo.Baseand implements the following new ones.- modified_files() list[str][source]¶
files = backend.modified_files()
Check if files from
watchhave been modified since the last check and return their names. Meant to be overloaded in a subclass.
- watch: list[Any]¶
watch = backend.watch backend.watch = ['/home/sri/my_app']
Files and directories to watch for changes, defaults to the application script as well as the
libandtemplatesdirectories in the current working directory.