PKG-INFO 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. Metadata-Version: 1.1
  2. Name: django-appconf
  3. Version: 1.0.3
  4. Summary: A helper class for handling configuration defaults of packaged apps gracefully.
  5. Home-page: https://django-appconf.readthedocs.io/
  6. Author: Jannis Leidel
  7. Author-email: jannis@leidel.info
  8. License: BSD
  9. Project-URL: Source, https://github.com/django-compressor/django-appconf
  10. Description: django-appconf
  11. ==============
  12. .. image:: http://codecov.io/github/django-compressor/django-appconf/coverage.svg?branch=develop
  13. :alt: Code Coverage
  14. :target: http://codecov.io/github/django-compressor/django-appconf?branch=develop
  15. .. image:: https://secure.travis-ci.org/django-compressor/django-appconf.svg?branch=develop
  16. :alt: Build Status
  17. :target: http://travis-ci.org/django-compressor/django-appconf
  18. A helper class for handling configuration defaults of packaged Django
  19. apps gracefully.
  20. .. note::
  21. This app precedes Django's own AppConfig_ classes that act as
  22. "objects [to] store metadata for an application" inside Django's
  23. app loading mechanism. In other words, they solve a related but
  24. different use case than django-appconf and can't easily be used
  25. as a replacement. The similarity in name is purely coincidental.
  26. .. _AppConfig: https://docs.djangoproject.com/en/stable/ref/applications/#django.apps.AppConfig
  27. Overview
  28. --------
  29. Say you have an app called ``myapp`` with a few defaults, which you want
  30. to refer to in the app's code without repeating yourself all the time.
  31. ``appconf`` provides a simple class to implement those defaults. Simply add
  32. something like the following code somewhere in your app files:
  33. .. code-block:: python
  34. from appconf import AppConf
  35. class MyAppConf(AppConf):
  36. SETTING_1 = "one"
  37. SETTING_2 = (
  38. "two",
  39. )
  40. .. note::
  41. ``AppConf`` classes depend on being imported during startup of the Django
  42. process. Even though there are multiple modules loaded automatically,
  43. only the ``models`` modules (usually the ``models.py`` file of your
  44. app) are guaranteed to be loaded at startup. Therefore it's recommended
  45. to put your ``AppConf`` subclass(es) there, too.
  46. The settings are initialized with the capitalized app label of where the
  47. setting is located at. E.g. if your ``models.py`` with the ``AppConf`` class
  48. is in the ``myapp`` package, the prefix of the settings will be ``MYAPP``.
  49. You can override the default prefix by specifying a ``prefix`` attribute of
  50. an inner ``Meta`` class:
  51. .. code-block:: python
  52. from appconf import AppConf
  53. class AcmeAppConf(AppConf):
  54. SETTING_1 = "one"
  55. SETTING_2 = (
  56. "two",
  57. )
  58. class Meta:
  59. prefix = 'acme'
  60. The ``MyAppConf`` class will automatically look at Django's global settings
  61. to determine if you've overridden it. For example, adding this to your site's
  62. ``settings.py`` would override ``SETTING_1`` of the above ``MyAppConf``:
  63. .. code-block:: python
  64. ACME_SETTING_1 = "uno"
  65. In case you want to use a different settings object instead of the default
  66. ``'django.conf.settings'``, set the ``holder`` attribute of the inner
  67. ``Meta`` class to a dotted import path:
  68. .. code-block:: python
  69. from appconf import AppConf
  70. class MyAppConf(AppConf):
  71. SETTING_1 = "one"
  72. SETTING_2 = (
  73. "two",
  74. )
  75. class Meta:
  76. prefix = 'acme'
  77. holder = 'acme.conf.settings'
  78. If you ship an ``AppConf`` class with your reusable Django app, it's
  79. recommended to put it in a ``conf.py`` file of your app package and
  80. import ``django.conf.settings`` in it, too:
  81. .. code-block:: python
  82. from django.conf import settings
  83. from appconf import AppConf
  84. class MyAppConf(AppConf):
  85. SETTING_1 = "one"
  86. SETTING_2 = (
  87. "two",
  88. )
  89. In the other files of your app you can easily make sure the settings
  90. are correctly loaded if you import Django's settings object from that
  91. module, e.g. in your app's ``views.py``:
  92. .. code-block:: python
  93. from django.http import HttpResponse
  94. from myapp.conf import settings
  95. def index(request):
  96. text = 'Setting 1 is: %s' % settings.MYAPP_SETTING_1
  97. return HttpResponse(text)
  98. Platform: UNKNOWN
  99. Classifier: Development Status :: 5 - Production/Stable
  100. Classifier: Environment :: Web Environment
  101. Classifier: Framework :: Django
  102. Classifier: Framework :: Django :: 1.8
  103. Classifier: Framework :: Django :: 1.9
  104. Classifier: Framework :: Django :: 1.10
  105. Classifier: Framework :: Django :: 1.11
  106. Classifier: Framework :: Django :: 2.0
  107. Classifier: Framework :: Django :: 2.1
  108. Classifier: Intended Audience :: Developers
  109. Classifier: License :: OSI Approved :: BSD License
  110. Classifier: Operating System :: OS Independent
  111. Classifier: Programming Language :: Python
  112. Classifier: Programming Language :: Python :: 2
  113. Classifier: Programming Language :: Python :: 2.7
  114. Classifier: Programming Language :: Python :: 3
  115. Classifier: Programming Language :: Python :: 3.4
  116. Classifier: Programming Language :: Python :: 3.5
  117. Classifier: Programming Language :: Python :: 3.6
  118. Classifier: Programming Language :: Python :: 3.7
  119. Classifier: Topic :: Utilities