Skip to content
Myr

Updated instance path documentation to explain the $PREFIX lookup

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent d3ca551 · Browse files · 1 file+20 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−8 removed

  • other:+20 added−8 removed

1 file+20 added−8 removed

modified:docs/config.rst+20 added-8 removed
297 unmodified lines
298“instance folder”. The instance folder is designed to not be under299version control and be deployment specific. It's the perfect place to300drop things that either change at runtime or configuration files.301302To make it easier to put this folder into an ignore list for your version303control system it's called ``instance`` and placed directly next to your304package or module by default. This path can be overridden by specifying305the `instance_path` parameter to your application::302You can either explicitly provide the path of the instance folder when303creating the Flask application or you can let Flask autodetect the304instance folder. For explicit configuration use the `instance_path`305parameter::306307 app = Flask(__name__, instance_path='/path/to/instance/folder')308309Default locations::309Please keep in mind that this path *must* be absolute when provided.310311 Module situation:311If the `instance_path` parameter is not provided the following default312locations are used:313314- Uninstalled module::315316 /myapp.py317 /instance318315 Package situation:319- Uninstalled package::320321 /myapp322 /__init__.py323 /instance324320Please keep in mind that this path *must* be absolute when provided.325- Installed module or package::326327 $PREFIX/lib/python2.X/site-packages/myapp328 $PREFIX/var/myapp-instance329330 ``$PREFIX`` is the prefix of your Python installation. This can be331 ``/usr`` or the path to your virtualenv. You can print the value of332 ``sys.prefix`` to see what the prefix is set to.333334Since the config object provided loading of configuration files from335relative filenames we made it possible to change the loading via filenames336to be relative to the instance path if wanted. The behavior of relative337paths in config files can be flipped between “relative to the application
26 unmodified lines