{ "info": { "author": "Richard Terry", "author_email": "code@radiac.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "===================\nDjango Yaa-Settings\n===================\n\nYet Another App Settings - manage settings for your reusable app\n\n* Project site: http://radiac.net/projects/django-yaa-settings/\n* Source code: https://github.com/radiac/django-yaa-settings\n\n.. image:: https://travis-ci.org/radiac/django-yaa-settings.svg?branch=master\n :target: https://travis-ci.org/radiac/django-yaa-settings\n\n.. image:: https://coveralls.io/repos/github/radiac/django-yaa-settings/badge.svg?branch=master\n :target: https://coveralls.io/github/radiac/django-yaa-settings?branch=master\n\n\nFeatures\n========\n\n* Easy to install and use\n* Provide defaults and validate user settings before use\n* Works with Django's settings overrides in tests\n\n\nVersion 1.0.0; supports Django 1.8, 1.11 and 2.0 on Python 2.7 and 3.4 upwards.\n\n\nInstallation\n============\n\nInstall from pip::\n\n pip install django-yaa-settings\n\n\nUsage\n=====\n\nIn your app, create a local ``app_settings.py``::\n\n from yaa_settings import AppSettings\n\n class MySettings(AppSettings):\n prefix = 'MYAPP'\n\n # Can be overridden in Django settings as MYAPP_ATTRIBUTE\n ATTRIBUTE = 'a static value defined at class creation'\n\n @property\n def PROPERTY(self):\n \"\"\"\n Return a value calculated whenever it is accessed\n\n Can be overridden in Django settings as MYAPP_PROPERTY\n \"\"\"\n return 'a value calculated when accessed'\n\n def CALLABLE(self, value):\n \"\"\"\n Always called, passed the MYAPP_CALLABLE value from Django settings\n (or passed None if that is not defined)\n \"\"\"\n if value is None:\n raise ValueError('MYAPP_CALLABLE must be configured')\n return value\n\n\n* Import and subclass ``AppSettings``\n* Only define one ``AppSettings`` subclass per file\n* Set the ``prefix`` attribute if you want to give your settings a prefix in\n Django's settings.\n* Settings should be uppercase for consistency with main Django settings.\n\n\nNow you can access your app's settings directly on the class, without the\nprefix::\n\n from . import app_settings\n\n def some_method(request):\n if app_settings.ATTRIBUTE == 1:\n return app_settings.PROPERTY\n return app_settings.CALLABLE\n\n\nYou can override these settings in your main Django settings, using the\nprefix::\n\n MYAPP_ATTRIBUTE = 'value available as app_settings.ATTRIBUTE'\n MYAPP_PROPERTY = 'value available as app_settings.PROPERTY'\n MYAPP_CALLABLE = 'value passed to MySettings.CALLABLE'\n\n\nWhy?\n====\n\nUse the ``prefix`` to namespace your settings\n---------------------------------------------\n\nIt's always a good idea to namespace your settings based on your app's name to\navoid collisions with other apps. By using the ``prefix`` attribute you can\nomit the prefix throughout your app, making your code neater.\n\nThe prefix is optional and you can manually namespace your settings if you'd\nprefer the consistency of using the same full setting throughout your project.\n\n\nNamespace settings while retaining test support\n-----------------------------------------------\n\nUsing the ``prefix`` mimicks the simpler ``settings.py`` that you find in some\nprojects::\n\n from django.conf import settings\n SETTING = getattr(settings, 'MYAPP_SETTINGS', 'default')\n\nbut unlike that simpler pattern, Yaa-Settings still works with standard setting\noverrides for tests - see the\n`Django documentation `_\nfor more details.\n\n\nCreate dynamic defaults using properties\n----------------------------------------\n\nA property on your ``AppSettings`` subclass will be evaluated every time you\naccess it, unless you override it in Django's settings. This allows you to\ngenerate dynamic defaults at runtime.\n\n\n\nValidate or standardise settings using methods\n----------------------------------------------\n\nA method on your ``AppSettings`` subclass will be called every time you access\nit, and will be passed the value you have defined in Django's settings. This\nallows you to validate settings, or process them ready for use.\n\n\nChangelog\n=========\n\n* 1.0.0, 2018-06-24: Released as stable\n* 0.1.0, 2018-06-24: Initial release", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://radiac.net/projects/django-yaa-settings/", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-yaa-settings", "package_url": "https://pypi.org/project/django-yaa-settings/", "platform": "", "project_url": "https://pypi.org/project/django-yaa-settings/", "project_urls": { "Homepage": "http://radiac.net/projects/django-yaa-settings/" }, "release_url": "https://pypi.org/project/django-yaa-settings/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Yet Another App Settings for Django", "version": "1.0.0" }, "last_serial": 3996511, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f58d3b8ac6eb108749638ec6a3cbc656", "sha256": "76ce9264f62d35983a3f1d4922ad9fbc39b183a561a2ec369fc7c4e36ba29b20" }, "downloads": -1, "filename": "django_yaa_settings-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f58d3b8ac6eb108749638ec6a3cbc656", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4177, "upload_time": "2018-06-24T08:16:26", "url": "https://files.pythonhosted.org/packages/ed/b5/ae78c57553f44f645a94116ec53b01b39fd8d63650222119d61533975619/django_yaa_settings-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1c6126deab7143c128ddc3bde136cd9", "sha256": "4cc44a91ec060f85d3ffd792215d10bca22e25747d7c46dc143edf9fc5a721f9" }, "downloads": -1, "filename": "django-yaa-settings-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e1c6126deab7143c128ddc3bde136cd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7362, "upload_time": "2018-06-24T08:16:27", "url": "https://files.pythonhosted.org/packages/3d/51/95f597da856b50f1c568aac0a94ef30f04e7782e8d1699f6947a66fcc612/django-yaa-settings-0.1.0.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "3cf6a5e1def9fbe445c96b7b4c7d3347", "sha256": "a561022f834fceaa54b7ce2530dfd6331d7ec7c38547e7e6c012c21a1cbd63cf" }, "downloads": -1, "filename": "django-yaa-settings-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3cf6a5e1def9fbe445c96b7b4c7d3347", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7434, "upload_time": "2018-06-24T08:48:04", "url": "https://files.pythonhosted.org/packages/7c/d3/b08533568627b1f3dfcf3f868860e1fafa8e4fa13abf3fbce6d78c89947e/django-yaa-settings-0.1.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "e6ea1723a87722c28c033fe68240e8fe", "sha256": "1ceb8fd36f4a56a990219a128b84b6fe73813ccad177af65d8fa59f67c83a495" }, "downloads": -1, "filename": "django-yaa-settings-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e6ea1723a87722c28c033fe68240e8fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7429, "upload_time": "2018-06-24T09:55:33", "url": "https://files.pythonhosted.org/packages/9c/97/8e365c9099c1fc26b93d4ac19ada3b392bc257537a420b0667a2e2f680ff/django-yaa-settings-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e6ea1723a87722c28c033fe68240e8fe", "sha256": "1ceb8fd36f4a56a990219a128b84b6fe73813ccad177af65d8fa59f67c83a495" }, "downloads": -1, "filename": "django-yaa-settings-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e6ea1723a87722c28c033fe68240e8fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7429, "upload_time": "2018-06-24T09:55:33", "url": "https://files.pythonhosted.org/packages/9c/97/8e365c9099c1fc26b93d4ac19ada3b392bc257537a420b0667a2e2f680ff/django-yaa-settings-1.0.0.tar.gz" } ] }