plaf

Lets make easy to load settings from any python file.


License
GPL-3.0
Install
pip install plaf==0.1.8

Documentation

plaf

Documentation Status Travis-CI Build Status Coverage Status
PyPI Package latest release PyPI Package monthly downloads PyPI Wheel Supported versions Supported imlementations

Allows you set or override local settings into your project

  • Free software: GPL V3 license

Installation

pip install plaf

Documentation

Plaf today gives you two methods:

To import a file just do:

>>> import plaf
>>> module = plaf.import_python_file('/path/to/my/pythonfile.py')
>>> module.something_defined_at_pythonfile
True

To update your settings, you have to give plaf two arguments:

  • filepath -- Full path to a python file you want to import settings from
  • context -- A dict with settings you want to be updated
>>> plaf.update_settings('/opt/project/dev/settings.py', locals())

I usually use at Django projects plaf.update_settings to override settings, instead of doing:

>>> try:
...     from local_settings.py import *
... except:
...     pass

I just prefer to use plaf.update_settings like:

>>> import plaf
>>> plaf.update_settings('/opt/project/devel/settings.py', locals())