How to initialize global variables in TurboGears 2 with values from a table
问题 I need a global variable that I can call from the templates. I edited app_globals.py in lib directory to declare PATH_TO_IMAGES like this class Globals(object): """Container for objects available throughout the life of the application. One instance of Globals is created during application initialization and is available during requests via the 'app_globals' variable. """ PATH_TO_IMAGES = "" def __init__(self): """Do nothing, by default.""" pass Now I can call from any template the image path