I’m developing a Bottle application.
My program reads configurations from configuration (.cfg) files and also using template (.tpl) files.
But when I host my app on nginx using uWSGI, it cannot find the files (given relative paths to the project)
What is the possible solution??
Instead of using relative paths, store an absolute path based on the current module path:
__file__is the filename of the current module,os.path.dirname(__file__)is the directory the module resides in.You should never rely on relative paths in Python code; the current working directory is not changed when running a python program.