Pyjoyment.Command.reload - Reload command¶
Usage: APPLICATION reload [OPTIONS] [COMMAND] [ARGS]
./myapp.py reload
./myapp.py reload prefork -w 1
./myapp.py reload -l http://127.0.0.1:8080 -w assets/css prefork -w 3
./myapp.py reload -m production -l https://*:443 -l http://[::]:3000
./myapp.py reload -w /usr/local/lib -w public -w myapp.conf
./myapp.py reload -x 'npx webpack --watch'
python -m MyApp reload
Options:
-b, --backend <name> Reload backend to use for reloading,
defaults to "Poll"
-h, --help Show this summary of available options
--home <path> Path to home directory of your application,
defaults to the value of PYJO_HOME or
auto-detection
-l, --listen <location> One or more locations you want to listen on,
defaults to the value of PYJO_LISTEN, the
port of PORT or "http://*:3000"
--log-format <name> Format of log messages, "text", "plain"
without time and process, or "json",
defaults to the value of PYJO_LOG_FORMAT or
"text"
-m, --mode <name> Operating mode for your application,
defaults to the value of PYJO_MODE or
"development"
-v, --verbose Print details about what files changed to
sys.stdout
-w, --watch <directory/file> One or more directories and files to watch
for changes, defaults to the application
script, the package of the application in
its home, as well as the "lib" and
"templates" directories in the current
working directory
-x, --exec <command> One or more shell commands to start
alongside the server, like asset bundlers in
watch mode
Pyjoyment.Command.reload starts applications with the
Pyjo.Server.Reload restarter, as pyjo-reload does, with the
script of the application that runs the command: the script of
Pyjoyment.Lite, or the __main__ module of the package of an
application, which python -m runs, whose package is watched too. The
server command defaults to daemon, and all options of the command need to
come before it.
This is a core command, that means it is always enabled and its code a good example for learning to build new commands, you’re welcome to fork it.
See Pyjoyment.Commands for a list of commands that are available by
default.
See also¶
Classes¶
- class Pyjoyment.Command.reload.Pyjoyment_Command_reload(**kwargs: Any)[source]¶
Pyjoyment.Command.reloadinherits all attributes and methods fromPyjoyment.Commandand implements the following new ones.- build_server(*args: str) Pyjo_Server_Reload[source]¶
reload = reload.build_server(*sys.argv[1:])
Build
Pyjo.Server.Reloadinstance from command line arguments, the options before the server command.
- description = 'Start application with auto-restarting development server'¶
description = reload.description reload.description = 'Foo'
Short description of this command, used for the command list.
- property script: str[source]¶
path = reload.script
The script of the application, which
Pyjo.Server.Reloadruns with the server command: the one ofPYJO_EXE, asPyjoyment.Litesets it, or the one that Python runs, as the__main__module of a package forpython -m.
- usage = 'Usage: APPLICATION reload [OPTIONS] [COMMAND] [ARGS]\n\n ./myapp.py reload\n ./myapp.py reload prefork -w 1\n ./myapp.py reload -l http://127.0.0.1:8080 -w assets/css prefork -w 3\n ./myapp.py reload -m production -l https://*:443 -l http://[::]:3000\n ./myapp.py reload -w /usr/local/lib -w public -w myapp.conf\n ./myapp.py reload -x \'npx webpack --watch\'\n python -m MyApp reload\n\nOptions:\n -b, --backend <name> Reload backend to use for reloading,\n defaults to "Poll"\n -h, --help Show this summary of available options\n --home <path> Path to home directory of your application,\n defaults to the value of PYJO_HOME or\n auto-detection\n -l, --listen <location> One or more locations you want to listen on,\n defaults to the value of PYJO_LISTEN, the\n port of PORT or "http://*:3000"\n --log-format <name> Format of log messages, "text", "plain"\n without time and process, or "json",\n defaults to the value of PYJO_LOG_FORMAT or\n "text"\n -m, --mode <name> Operating mode for your application,\n defaults to the value of PYJO_MODE or\n "development"\n -v, --verbose Print details about what files changed to\n sys.stdout\n -w, --watch <directory/file> One or more directories and files to watch\n for changes, defaults to the application\n script, the package of the application in\n its home, as well as the "lib" and\n "templates" directories in the current\n working directory\n -x, --exec <command> One or more shell commands to start\n alongside the server, like asset bundlers in\n watch mode\n'¶
usage = reload.usage reload.usage = 'Foo'
Usage information for this command, used for the help screen.