Pyjo.Home - Home sweet home¶
from Pyjo.Home import Home
# Find and manage the project root directory
home = Home()
home.detect()
print(home.child('templates', 'layouts', 'default.html.ep'))
print(f'{home}')
# Or import the module, as in Google Python Style Guide
import Pyjo.Home
# Find and manage the project root directory
home = Pyjo.Home.new()
home.detect()
print(home.child('templates', 'layouts', 'default.html.ep'))
print(f'{home}')
Pyjo.Home is a container for home directories based on
Pyjo.File.
See also¶
Pyjoyment, https://mojolicious.org.
Ported from Mojo::Home of Mojolicious 9.49.
- class Pyjo.Home.Pyjo_Home(*parts: Anything)[source]¶
Pyjo.Homeinherits all methods fromPyjo.Fileand implements the following new ones.- detect(cls: type | ModuleType | str | None = None) Self[source]¶
home = home.detect() home = home.detect(MyApp) home = home.detect('My.App')
Detect home directory from the value of the
PYJO_HOMEenvironment variable or the location of the application class: a class, its module, or the dotted name of a module that is loaded. The directory of the module’s file, less the parts of the name of the module and alib,blib/liborsrcdirectory, is the home.