Debian Codegraph @

django_environ.egg-info/PKG-INFO

raw
1 Metadata-Version: 2.2
2 Name: django-environ
3 Version: 0.12.0
4 Summary: A package that allows you to utilize 12factor inspired environment variables to configure your Django application.
5 Home-page: https://django-environ.readthedocs.org
6 Author: Daniele Faraglia
7 Author-email: [email protected]
8 Maintainer: Serghei Iakovlev
9 Maintainer-email: [email protected]
10 License: MIT
11 Project-URL: Documentation, https://django-environ.readthedocs.org
12 Project-URL: Funding, https://opencollective.com/django-environ
13 Project-URL: Say Thanks!, https://saythanks.io/to/joke2k
14 Project-URL: Changelog, https://django-environ.readthedocs.org/en/latest/changelog.html
15 Project-URL: Bug Tracker, https://github.com/joke2k/django-environ/issues
16 Project-URL: Source Code, https://github.com/joke2k/django-environ
17 Keywords: environment,django,variables,12factor
18 Platform: any
19 Classifier: Development Status :: 5 - Production/Stable
20 Classifier: Framework :: Django
21 Classifier: Framework :: Django :: 2.2
22 Classifier: Framework :: Django :: 3.0
23 Classifier: Framework :: Django :: 3.1
24 Classifier: Framework :: Django :: 3.2
25 Classifier: Framework :: Django :: 4.0
26 Classifier: Framework :: Django :: 4.1
27 Classifier: Framework :: Django :: 4.2
28 Classifier: Framework :: Django :: 5.0
29 Classifier: Framework :: Django :: 5.1
30 Classifier: Operating System :: OS Independent
31 Classifier: Intended Audience :: Developers
32 Classifier: Natural Language :: English
33 Classifier: Programming Language :: Python
34 Classifier: Programming Language :: Python :: 3
35 Classifier: Programming Language :: Python :: 3.9
36 Classifier: Programming Language :: Python :: 3.10
37 Classifier: Programming Language :: Python :: 3.11
38 Classifier: Programming Language :: Python :: 3.12
39 Classifier: Programming Language :: Python :: 3.13
40 Classifier: Programming Language :: Python :: Implementation :: CPython
41 Classifier: Programming Language :: Python :: Implementation :: PyPy
42 Classifier: Topic :: Software Development :: Libraries :: Python Modules
43 Classifier: Topic :: Utilities
44 Classifier: License :: OSI Approved :: MIT License
45 Requires-Python: >=3.9,<4
46 Description-Content-Type: text/x-rst
47 License-File: LICENSE.txt
48 License-File: AUTHORS.rst
49 Provides-Extra: testing
50 Requires-Dist: coverage[toml]>=5.0a4; extra == "testing"
51 Requires-Dist: pytest>=4.6.11; extra == "testing"
52 Requires-Dist: setuptools>=71.0.0; extra == "testing"
53 Provides-Extra: docs
54 Requires-Dist: furo>=2024.8.6; extra == "docs"
55 Requires-Dist: sphinx>=5.0; extra == "docs"
56 Requires-Dist: sphinx-notfound-page; extra == "docs"
57 Provides-Extra: develop
58 Requires-Dist: coverage[toml]>=5.0a4; extra == "develop"
59 Requires-Dist: pytest>=4.6.11; extra == "develop"
60 Requires-Dist: setuptools>=71.0.0; extra == "develop"
61 Requires-Dist: furo>=2024.8.6; extra == "develop"
62 Requires-Dist: sphinx>=5.0; extra == "develop"
63 Requires-Dist: sphinx-notfound-page; extra == "develop"
64 Dynamic: author
65 Dynamic: author-email
66 Dynamic: classifier
67 Dynamic: description
68 Dynamic: description-content-type
69 Dynamic: home-page
70 Dynamic: keywords
71 Dynamic: license
72 Dynamic: maintainer
73 Dynamic: maintainer-email
74 Dynamic: platform
75 Dynamic: project-url
76 Dynamic: provides-extra
77 Dynamic: requires-python
78 Dynamic: summary
79
80 ==============
81 django-environ
82 ==============
83
84
85 ``django-environ`` is the Python package that allows you to use
86 `Twelve-factor methodology <https://www.12factor.net/>`_ to configure your
87 Django application with environment variables.
88
89 .. -teaser-end-
90
91 For that, it gives you an easy way to configure Django application using
92 environment variables obtained from an environment file and provided by the OS:
93
94 .. -code-begin-
95
96 .. code-block:: python
97
98 import environ
99 import os
100
101 env = environ.Env(
102 # set casting, default value
103 DEBUG=(bool, False)
104 )
105
106 # Set the project base directory
107 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
108
109 # Take environment variables from .env file
110 environ.Env.read_env(os.path.join(BASE_DIR, '.env'))
111
112 # False if not in os.environ because of casting above
113 DEBUG = env('DEBUG')
114
115 # Raises Django's ImproperlyConfigured
116 # exception if SECRET_KEY not in os.environ
117 SECRET_KEY = env('SECRET_KEY')
118
119 # Parse database connection url strings
120 # like psql://user:[email protected]:8458/db
121 DATABASES = {
122 # read os.environ['DATABASE_URL'] and raises
123 # ImproperlyConfigured exception if not found
124 #
125 # The db() method is an alias for db_url().
126 'default': env.db(),
127
128 # read os.environ['SQLITE_URL']
129 'extra': env.db_url(
130 'SQLITE_URL',
131 default='sqlite:////tmp/my-tmp-sqlite.db'
132 )
133 }
134
135 CACHES = {
136 # Read os.environ['CACHE_URL'] and raises
137 # ImproperlyConfigured exception if not found.
138 #
139 # The cache() method is an alias for cache_url().
140 'default': env.cache(),
141
142 # read os.environ['REDIS_URL']
143 'redis': env.cache_url('REDIS_URL')
144 }
145
146 .. -overview-
147
148 The idea of this package is to unify a lot of packages that make the same stuff:
149 Take a string from ``os.environ``, parse and cast it to some of useful python
150 typed variables. To do that and to use the `12factor <https://www.12factor.net/>`_
151 approach, some connection strings are expressed as url, so this package can parse
152 it and return a ``urllib.parse.ParseResult``. These strings from ``os.environ``
153 are loaded from a ``.env`` file and filled in ``os.environ`` with ``setdefault``
154 method, to avoid to overwrite the real environ.
155 A similar approach is used in
156 `Two Scoops of Django <https://web.archive.org/web/20240121133956/https://www.feldroy.com/books/two-scoops-of-django-3-x>`_
157 book and explained in `12factor-django <https://wellfire.co/learn/easier-12-factor-django>`_
158 article.
159
160
161 Using ``django-environ`` you can stop to make a lot of unversioned
162 ``settings_*.py`` to configure your app.
163 See `cookiecutter-django <https://github.com/cookiecutter/cookiecutter-django>`_
164 for a concrete example on using with a django project.
165
166 **Feature Support**
167
168 - Fast and easy multi environment for deploy
169 - Fill ``os.environ`` with .env file variables
170 - Variables casting
171 - Url variables exploded to django specific package settings
172 - Optional support for Docker-style file based config variables (use
173 ``environ.FileAwareEnv`` instead of ``environ.Env``)
174
175 .. -project-information-
176
177 Project Information
178 ===================
179
180 ``django-environ`` is released under the `MIT / X11 License <https://choosealicense.com/licenses/mit/>`__,
181 its documentation lives at `Read the Docs <https://django-environ.readthedocs.io/en/latest/>`_,
182 the code on `GitHub <https://github.com/joke2k/django-environ>`_,
183 and the latest release on `PyPI <https://pypi.org/project/django-environ/>`_.
184
185 It’s rigorously tested on Python 3.9+, and officially supports
186 Django 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0, and 5.1.
187
188 If you'd like to contribute to ``django-environ`` you're most welcome!
189
190 .. -support-
191
192 Support
193 =======
194
195 Should you have any question, any remark, or if you find a bug, or if there is
196 something you can't do with the ``django-environ``, please
197 `open an issue <https://github.com/joke2k/django-environ>`_.
198
199
200 Contributing
201 ============
202
203 If you would like to contribute to ``django-environ``, please take a look at the
204 `current issues <https://github.com/joke2k/django-environ/issues>`_. If there is
205 a bug or feature that you want but it isn't listed, make an issue and work on it.
206
207 Bug reports
208 -----------
209
210 *Before raising an issue, please ensure that you are using the latest version
211 of django-environ.*
212
213 Please provide the following information with your issue to enable us to
214 respond as quickly as possible.
215
216 * The relevant versions of the packages you are using.
217 * The steps to recreate your issue.
218 * The full stacktrace if there is an exception.
219 * An executable code example where possible
220
221 Guidelines for bug reports:
222
223 * **Use the GitHub issue search** β€” check if the issue has already been
224 reported.
225 * **Check if the issue has been fixed** β€” try to reproduce it using the latest
226 ``main`` or ``develop`` branch in the repository.
227 * Isolate the problem β€” create a reduced test case and a live example.
228
229 A good bug report shouldn't leave others needing to chase you up for more
230 information. Please try to be as detailed as possible in your report. What is
231 your environment? What steps will reproduce the issue? What OS experience the
232 problem? What would you expect to be the outcome? All these details will help
233 people to fix any potential bugs.
234
235 Feature requests
236 ----------------
237
238 Feature requests are welcome. But take a moment to find out whether your idea
239 fits with the scope and aims of the project. It's up to *you* to make a strong
240 case to convince the project's developers of the merits of this feature. Please
241 provide as much detail and context as possible.
242
243 Pull requests
244 -------------
245
246 Good pull requests - patches, improvements, new features - are a fantastic
247 help. They should remain focused in scope and avoid containing unrelated
248 commits.
249
250 Follow this process if you'd like your work considered for inclusion in the
251 project:
252
253 1. Check for open issues or open a fresh issue to start a discussion around a
254 feature idea or a bug.
255 2. Fork `the repository <https://github.com/joke2k/django-environ>`_
256 on GitHub to start making your changes to the ``develop`` branch
257 (or branch off of it).
258 3. Write a test which shows that the bug was fixed or that the feature works as
259 expected.
260 4. Send a pull request and bug the maintainer until it gets merged and published.
261
262 If you are intending to implement a fairly large feature we'd appreciate if you
263 open an issue with GitHub detailing your use case and intended solution to
264 discuss how it might impact other work that is in flight.
265
266 We also appreciate it if you take the time to update and write tests for any
267 changes you submit.
268
269 **By submitting a patch, you agree to allow the project owner to license your
270 work under the same license as that used by the project.**
271
272 Resources
273 ---------
274
275 * `How to Contribute to Open Source <https://opensource.guide/how-to-contribute/>`_
276 * `Using Pull Requests <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>`_
277 * `Writing good commit messages <https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`_
278
279
280 Release Information
281 ===================
282
283 v0.12.0 - 8-November-2024
284 -----------------------------
285 Fixed
286 +++++
287 - Include prefix in the ``ImproperlyConfigured`` error message
288 `#513 <https://github.com/joke2k/django-environ/issues/513>`_.
289
290 Added
291 +++++
292 - Add support for Python 3.12 and 3.13
293 `#538 <https://github.com/joke2k/django-environ/issues/538>`_.
294 - Add support for Django 5.1
295 `#535 <https://github.com/joke2k/django-environ/issues/535>`_.
296 - Add support for Django CockroachDB driver
297 `#509 <https://github.com/joke2k/django-environ/issues/509>`_.
298 - Add support for Django Channels
299 `#266 <https://github.com/joke2k/django-environ/issues/266>`_.
300
301 Changed
302 +++++++
303 - Disabled inline comments handling by default due to potential side effects.
304 While the feature itself is useful, the project's philosophy dictates that
305 it should not be enabled by default for all users
306 `#499 <https://github.com/joke2k/django-environ/issues/499>`_.
307
308 Removed
309 +++++++
310 - Removed support of Python 3.6, 3.7 and 3.8
311 `#538 <https://github.com/joke2k/django-environ/issues/538>`_.
312 - Removed support of Django 1.x.
313 `#538 <https://github.com/joke2k/django-environ/issues/538>`_.
314
315 `Full changelog <https://django-environ.readthedocs.org/en/latest/changelog.html>`_.
316
317 Security Policy
318 ===============
319
320
321 Reporting a Vulnerability
322 -------------------------
323
324 If you discover a security vulnerability within ``django-environ``, please
325 send an e-mail to Serghei Iakovlev via [email protected]. All security
326 vulnerabilities will be promptly addressed.
327
328
329 Credits
330 =======
331
332 ``django-environ`` was initially created by `Daniele Faraglia <https://github.com/joke2k>`_
333 and currently maintained by `Serghei Iakovlev <https://github.com/sergeyklay/>`_.
334
335 A full list of contributors can be found in `GitHub <https://github.com/joke2k/django-environ/graphs/contributors>`__.
336
337 Acknowledgments
338 ===============
339
340 The existence of ``django-environ`` would have been impossible without these
341 projects:
342
343 - `rconradharris/envparse <https://github.com/rconradharris/envparse>`_
344 - `jazzband/dj-database-url <https://github.com/jazzband/dj-database-url>`_
345 - `migonzalvar/dj-email-url <https://github.com/migonzalvar/dj-email-url>`_
346 - `ghickman/django-cache-url <https://github.com/ghickman/django-cache-url>`_
347 - `dstufft/dj-search-url <https://github.com/dstufft/dj-search-url>`_
348 - `julianwachholz/dj-config-url <https://github.com/julianwachholz/dj-config-url>`_
349 - `nickstenning/honcho <https://github.com/nickstenning/honcho>`_
350 - `rconradharris/envparse <https://github.com/rconradharris/envparse>`_