[Python-modules-commits] [django-environ] 02/06: New upstream version 0.4.3
Brian May
bam at moszumanska.debian.org
Thu Jul 6 07:14:31 UTC 2017
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch debian/master
in repository django-environ.
commit c1f25d92db04dca911b107ea20d530d2be7eedfa
Author: Brian May <brian at linuxpenguins.xyz>
Date: Thu Jul 6 17:08:46 2017 +1000
New upstream version 0.4.3
---
LICENSE.txt | 2 +-
MANIFEST.in | 3 +-
PKG-INFO | 121 ++++++++++++++++++++++++++++-------
README.rst | 105 ++++++++++++++++++++++++------
django_environ.egg-info/PKG-INFO | 121 ++++++++++++++++++++++++++++-------
django_environ.egg-info/SOURCES.txt | 6 +-
django_environ.egg-info/requires.txt | 2 +-
environ/environ.py | 121 +++++++++++++++++++++++------------
environ/test.py | 119 ++++++++++++++++++++++++++++------
environ/test_env.txt | 30 +++++++++
environ/tests/__init__.py | 7 ++
environ/tests/functional_tests.py | 50 +++++++++++++++
environ/tests/test_environment.py | 53 +++++++++++++++
setup.cfg | 5 +-
setup.py | 16 ++++-
15 files changed, 623 insertions(+), 138 deletions(-)
diff --git a/LICENSE.txt b/LICENSE.txt
index 5901005..98f52ba 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2013-2015, Daniele Faraglia
+Copyright (c) 2013-2017, Daniele Faraglia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/MANIFEST.in b/MANIFEST.in
index 60cf76f..5e1be43 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
include *.rst
-include *.txt
\ No newline at end of file
+include *.txt
+include environ/test_env.txt
\ No newline at end of file
diff --git a/PKG-INFO b/PKG-INFO
index e4744e8..c055783 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,8 +1,8 @@
Metadata-Version: 1.1
Name: django-environ
-Version: 0.4.0
+Version: 0.4.3
Summary: Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
-Home-page: http://github.com/joke2k/django-environ
+Home-page: https://github.com/joke2k/django-environ
Author: joke2k
Author-email: joke2k at gmail.com
License: MIT License
@@ -12,7 +12,7 @@ Description: ==============
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
- |pypi| |unix_build| |windows_build| |coverage| |downloads| |license|
+ |pypi| |unix_build| |windows_build| |coverage| |license|
This module is a merge of:
@@ -32,7 +32,7 @@ Description: ==============
This is your `settings.py` file before you have installed **django-environ**
- ::
+ .. code-block:: python
import os
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
@@ -48,7 +48,7 @@ Description: ==============
'PASSWORD': 'githubbedpassword',
'HOST': '127.0.0.1',
'PORT': '8458',
- }
+ },
'extra': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(SITE_ROOT, 'database.sqlite')
@@ -71,7 +71,7 @@ Description: ==============
},
'redis': {
'BACKEND': 'django_redis.cache.RedisCache',
- 'LOCATION': '127.0.0.1:6379:1',
+ 'LOCATION': '127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'PASSWORD': 'redis-githubbed-password',
@@ -79,7 +79,9 @@ Description: ==============
}
}
- After::
+ After:
+
+ .. code-block:: python
import environ
root = environ.Path(__file__) - 3 # three folder back (/a/b/c/ - 3 = /)
@@ -110,8 +112,11 @@ Description: ==============
'redis': env.cache('REDIS_URL')
}
- You can also pass `read_env()` an explicit path to the .env file.
- Create a `.env` file::
+ You can also pass ``read_env()`` an explicit path to the ``.env`` file.
+
+ Create a ``.env`` file:
+
+ .. code-block:: bash
DEBUG=on
# DJANGO_SETTINGS_MODULE=myapp.settings.dev
@@ -119,7 +124,7 @@ Description: ==============
DATABASE_URL=psql://urser:un-githubbedpassword@127.0.0.1:8458/database
# SQLITE_URL=sqlite:///my-local-sqlite.db
CACHE_URL=memcache://127.0.0.1:11211,127.0.0.1:11212,127.0.0.1:11213
- REDIS_URL=rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
+ REDIS_URL=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
How to install
@@ -133,9 +138,9 @@ Description: ==============
How to use
==========
- There are only two classes, `environ.Env` and `environ.Path`
+ There are only two classes, ``environ.Env`` and ``environ.Path``
- ::
+ .. code-block:: python
>>> import environ
>>> env = environ.Env(
@@ -165,6 +170,9 @@ Description: ==============
'/home/myproject/static'
+ See `cookiecutter-django`_ for a concrete example on using with a django project.
+
+
Supported Types
===============
@@ -175,7 +183,8 @@ Description: ==============
- json
- list (FOO=a,b,c)
- tuple (FOO=(a,b,c))
- - dict (BAR=key=val,foo=bar)
+ - dict (BAR=key=val,foo=bar) #environ.Env(BAR=(dict, {}))
+ - dict (BAR=key=val;foo=1.1;baz=True) #environ.Env(BAR=(dict(value=unicode, cast=dict(foo=float,baz=bool)), {}))
- url
- path (environ.Path)
- db_url
@@ -185,6 +194,8 @@ Description: ==============
- MySQL for GeoDjango: mysqlgis://
- SQLITE: sqlite://
- SQLITE with SPATIALITE for GeoDjango: spatialite://
+ - Oracle: oracle://
+ - Redshift: redshift://
- LDAP: ldap://
- cache_url
- Database: dbcache://
@@ -209,6 +220,43 @@ Description: ==============
- LocMem mail: memorymail://
- Dummy mail: dummymail://
+ Tips
+ ====
+
+ Using unsafe characters in URLs
+ -------------------------------
+
+ In order to use unsafe characters you have to encode with ``urllib.parse.encode`` before you set into ``.env`` file.
+
+ .. code-block::
+
+ DATABASE_URL=mysql://user:%23password@127.0.0.1:3306/dbname
+
+
+ See https://perishablepress.com/stop-using-unsafe-characters-in-urls/ for reference.
+
+ Email settings
+ --------------
+
+ In order to set email configuration for django you can use this code:
+
+ .. code-block:: python
+
+ EMAIL_CONFIG = env.email_url(
+ 'EMAIL_URL', default='smtp://user@:password@localhost:25')
+
+ vars().update(EMAIL_CONFIG)
+
+
+ SQLite urls
+ -----------
+
+ SQLite connects to file based databases. The same URL format is used, omitting the hostname,
+ and using the "file" portion as the filename of the database.
+ This has the effect of four slashes being present for an absolute
+ file path: sqlite:////full/path/to/your/database/file.sqlite.
+
+
Tests
=====
@@ -222,13 +270,30 @@ Description: ==============
License
=======
- Django-environ is licensed under the MIT License - see the `LICENSE`_ file for details
+ Django-environ is licensed under the MIT License - see the `LICENSE_FILE`_ file for details
Changelog
=========
- `0.4.0 - 23-September-2015 <http://github.com/joke2k/django-environ/compare/v0.3...v0.4>`__
- -------------------------------------------------------------------------------------------
+ `0.4.2 - 13-April-2017 <https://github.com/joke2k/django-environ/compare/v0.4.1...v0.4.2>`__
+ --------------------------------------------------------------------------------------------
+
+ - Confirm support for Django 1.11.
+ - Support for Redshift database URL
+ - Fix uwsgi settings reload problem (#55)
+ - Update support for django-redis urls (#109)
+
+ `0.4.1 - 13-November-2016 <https://github.com/joke2k/django-environ/compare/v0.4...v0.4.1>`__
+ ---------------------------------------------------------------------------------------------
+ - Fix for unsafe characters into URLs
+ - Clarifying warning on missing or unreadable file. Thanks to @nickcatal
+ - Add support for Django 1.10.
+ - Fix support for Oracle urls
+ - Fix support for django-redis
+
+
+ `0.4.0 - 23-September-2015 <https://github.com/joke2k/django-environ/compare/v0.3...v0.4>`__
+ --------------------------------------------------------------------------------------------
- Fix non-ascii values (broken in Python 2.x)
- New email schemes - smtp+ssl and smtp+tls (smtps would be deprecated)
- redis_cache replaced by django_redis
@@ -236,8 +301,8 @@ Description: ==============
- Add LDAP url support for database (django-ldapdb)
- Fix psql/pgsql url
- `0.3 - 03-June-2014 <http://github.com/joke2k/django-environ/compare/v0.2.1...v0.3>`__
- --------------------------------------------------------------------------------------
+ `0.3 - 03-June-2014 <https://github.com/joke2k/django-environ/compare/v0.2.1...v0.3>`__
+ ---------------------------------------------------------------------------------------
- Add cache url support
- Add email url support
- Add search url support
@@ -302,6 +367,8 @@ Description: ==============
.. _Distribute: http://pypi.python.org/pypi/distribute
.. _`modern-package-template`: http://pypi.python.org/pypi/modern-package-template
+ .. _cookiecutter-django: https://github.com/pydanny/cookiecutter-django
+
.. |pypi| image:: https://img.shields.io/pypi/v/django-environ.svg?style=flat-square&label=version
:target: https://pypi.python.org/pypi/django-environ
:alt: Latest version released on PyPi
@@ -318,23 +385,29 @@ Description: ==============
:target: https://ci.appveyor.com/project/joke2k/django-environ
:alt: Build status of the master branch on Windows
- .. |downloads| image:: https://img.shields.io/pypi/dm/django-environ.svg?style=flat-square
- :target: https://pypi.python.org/pypi/django-environ
- :alt: Monthly downloads
-
.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
:target: https://raw.githubusercontent.com/joke2k/django-environ/master/LICENSE.txt
:alt: Package license
- .. _LICENSE: https://github.com/joke2k/django-environ/blob/master/LICENSE.txt
+ .. _LICENSE_FILE: https://github.com/joke2k/django-environ/blob/master/LICENSE.txt
-Keywords: d,j,a,n,g,o, ,e,n,v,i,r,o,n,m,e,n,t, ,v,a,r,i,a,b,l,e,s, ,1,2,f,a,c,t,o,r
+Keywords: django environment variables 12factor
Platform: any
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Information Technology
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
+Classifier: Framework :: Django :: 1.11
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: MIT License
diff --git a/README.rst b/README.rst
index 151f8d7..314d095 100644
--- a/README.rst
+++ b/README.rst
@@ -4,7 +4,7 @@ Django-environ
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
-|pypi| |unix_build| |windows_build| |coverage| |downloads| |license|
+|pypi| |unix_build| |windows_build| |coverage| |license|
This module is a merge of:
@@ -24,7 +24,7 @@ and inspired by:
This is your `settings.py` file before you have installed **django-environ**
-::
+.. code-block:: python
import os
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
@@ -40,7 +40,7 @@ This is your `settings.py` file before you have installed **django-environ**
'PASSWORD': 'githubbedpassword',
'HOST': '127.0.0.1',
'PORT': '8458',
- }
+ },
'extra': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(SITE_ROOT, 'database.sqlite')
@@ -63,7 +63,7 @@ This is your `settings.py` file before you have installed **django-environ**
},
'redis': {
'BACKEND': 'django_redis.cache.RedisCache',
- 'LOCATION': '127.0.0.1:6379:1',
+ 'LOCATION': '127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'PASSWORD': 'redis-githubbed-password',
@@ -71,7 +71,9 @@ This is your `settings.py` file before you have installed **django-environ**
}
}
-After::
+After:
+
+.. code-block:: python
import environ
root = environ.Path(__file__) - 3 # three folder back (/a/b/c/ - 3 = /)
@@ -102,8 +104,11 @@ After::
'redis': env.cache('REDIS_URL')
}
-You can also pass `read_env()` an explicit path to the .env file.
-Create a `.env` file::
+You can also pass ``read_env()`` an explicit path to the ``.env`` file.
+
+Create a ``.env`` file:
+
+.. code-block:: bash
DEBUG=on
# DJANGO_SETTINGS_MODULE=myapp.settings.dev
@@ -111,7 +116,7 @@ Create a `.env` file::
DATABASE_URL=psql://urser:un-githubbedpassword@127.0.0.1:8458/database
# SQLITE_URL=sqlite:///my-local-sqlite.db
CACHE_URL=memcache://127.0.0.1:11211,127.0.0.1:11212,127.0.0.1:11213
- REDIS_URL=rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
+ REDIS_URL=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
How to install
@@ -125,9 +130,9 @@ How to install
How to use
==========
-There are only two classes, `environ.Env` and `environ.Path`
+There are only two classes, ``environ.Env`` and ``environ.Path``
-::
+.. code-block:: python
>>> import environ
>>> env = environ.Env(
@@ -157,6 +162,9 @@ There are only two classes, `environ.Env` and `environ.Path`
'/home/myproject/static'
+See `cookiecutter-django`_ for a concrete example on using with a django project.
+
+
Supported Types
===============
@@ -167,7 +175,8 @@ Supported Types
- json
- list (FOO=a,b,c)
- tuple (FOO=(a,b,c))
-- dict (BAR=key=val,foo=bar)
+- dict (BAR=key=val,foo=bar) #environ.Env(BAR=(dict, {}))
+- dict (BAR=key=val;foo=1.1;baz=True) #environ.Env(BAR=(dict(value=unicode, cast=dict(foo=float,baz=bool)), {}))
- url
- path (environ.Path)
- db_url
@@ -177,6 +186,8 @@ Supported Types
- MySQL for GeoDjango: mysqlgis://
- SQLITE: sqlite://
- SQLITE with SPATIALITE for GeoDjango: spatialite://
+ - Oracle: oracle://
+ - Redshift: redshift://
- LDAP: ldap://
- cache_url
- Database: dbcache://
@@ -201,6 +212,43 @@ Supported Types
- LocMem mail: memorymail://
- Dummy mail: dummymail://
+Tips
+====
+
+Using unsafe characters in URLs
+-------------------------------
+
+In order to use unsafe characters you have to encode with ``urllib.parse.encode`` before you set into ``.env`` file.
+
+.. code-block::
+
+ DATABASE_URL=mysql://user:%23password@127.0.0.1:3306/dbname
+
+
+See https://perishablepress.com/stop-using-unsafe-characters-in-urls/ for reference.
+
+Email settings
+--------------
+
+In order to set email configuration for django you can use this code:
+
+.. code-block:: python
+
+ EMAIL_CONFIG = env.email_url(
+ 'EMAIL_URL', default='smtp://user@:password@localhost:25')
+
+ vars().update(EMAIL_CONFIG)
+
+
+SQLite urls
+-----------
+
+SQLite connects to file based databases. The same URL format is used, omitting the hostname,
+and using the "file" portion as the filename of the database.
+This has the effect of four slashes being present for an absolute
+file path: sqlite:////full/path/to/your/database/file.sqlite.
+
+
Tests
=====
@@ -214,13 +262,30 @@ Tests
License
=======
-Django-environ is licensed under the MIT License - see the `LICENSE`_ file for details
+Django-environ is licensed under the MIT License - see the `LICENSE_FILE`_ file for details
Changelog
=========
-`0.4.0 - 23-September-2015 <http://github.com/joke2k/django-environ/compare/v0.3...v0.4>`__
--------------------------------------------------------------------------------------------
+`0.4.2 - 13-April-2017 <https://github.com/joke2k/django-environ/compare/v0.4.1...v0.4.2>`__
+--------------------------------------------------------------------------------------------
+
+ - Confirm support for Django 1.11.
+ - Support for Redshift database URL
+ - Fix uwsgi settings reload problem (#55)
+ - Update support for django-redis urls (#109)
+
+`0.4.1 - 13-November-2016 <https://github.com/joke2k/django-environ/compare/v0.4...v0.4.1>`__
+---------------------------------------------------------------------------------------------
+ - Fix for unsafe characters into URLs
+ - Clarifying warning on missing or unreadable file. Thanks to @nickcatal
+ - Add support for Django 1.10.
+ - Fix support for Oracle urls
+ - Fix support for django-redis
+
+
+`0.4.0 - 23-September-2015 <https://github.com/joke2k/django-environ/compare/v0.3...v0.4>`__
+--------------------------------------------------------------------------------------------
- Fix non-ascii values (broken in Python 2.x)
- New email schemes - smtp+ssl and smtp+tls (smtps would be deprecated)
- redis_cache replaced by django_redis
@@ -228,8 +293,8 @@ Changelog
- Add LDAP url support for database (django-ldapdb)
- Fix psql/pgsql url
-`0.3 - 03-June-2014 <http://github.com/joke2k/django-environ/compare/v0.2.1...v0.3>`__
---------------------------------------------------------------------------------------
+`0.3 - 03-June-2014 <https://github.com/joke2k/django-environ/compare/v0.2.1...v0.3>`__
+---------------------------------------------------------------------------------------
- Add cache url support
- Add email url support
- Add search url support
@@ -294,6 +359,8 @@ Credits
.. _Distribute: http://pypi.python.org/pypi/distribute
.. _`modern-package-template`: http://pypi.python.org/pypi/modern-package-template
+.. _cookiecutter-django: https://github.com/pydanny/cookiecutter-django
+
.. |pypi| image:: https://img.shields.io/pypi/v/django-environ.svg?style=flat-square&label=version
:target: https://pypi.python.org/pypi/django-environ
:alt: Latest version released on PyPi
@@ -310,12 +377,8 @@ Credits
:target: https://ci.appveyor.com/project/joke2k/django-environ
:alt: Build status of the master branch on Windows
-.. |downloads| image:: https://img.shields.io/pypi/dm/django-environ.svg?style=flat-square
- :target: https://pypi.python.org/pypi/django-environ
- :alt: Monthly downloads
-
.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
:target: https://raw.githubusercontent.com/joke2k/django-environ/master/LICENSE.txt
:alt: Package license
-.. _LICENSE: https://github.com/joke2k/django-environ/blob/master/LICENSE.txt
+.. _LICENSE_FILE: https://github.com/joke2k/django-environ/blob/master/LICENSE.txt
diff --git a/django_environ.egg-info/PKG-INFO b/django_environ.egg-info/PKG-INFO
index e4744e8..c055783 100644
--- a/django_environ.egg-info/PKG-INFO
+++ b/django_environ.egg-info/PKG-INFO
@@ -1,8 +1,8 @@
Metadata-Version: 1.1
Name: django-environ
-Version: 0.4.0
+Version: 0.4.3
Summary: Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
-Home-page: http://github.com/joke2k/django-environ
+Home-page: https://github.com/joke2k/django-environ
Author: joke2k
Author-email: joke2k at gmail.com
License: MIT License
@@ -12,7 +12,7 @@ Description: ==============
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
- |pypi| |unix_build| |windows_build| |coverage| |downloads| |license|
+ |pypi| |unix_build| |windows_build| |coverage| |license|
This module is a merge of:
@@ -32,7 +32,7 @@ Description: ==============
This is your `settings.py` file before you have installed **django-environ**
- ::
+ .. code-block:: python
import os
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
@@ -48,7 +48,7 @@ Description: ==============
'PASSWORD': 'githubbedpassword',
'HOST': '127.0.0.1',
'PORT': '8458',
- }
+ },
'extra': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(SITE_ROOT, 'database.sqlite')
@@ -71,7 +71,7 @@ Description: ==============
},
'redis': {
'BACKEND': 'django_redis.cache.RedisCache',
- 'LOCATION': '127.0.0.1:6379:1',
+ 'LOCATION': '127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'PASSWORD': 'redis-githubbed-password',
@@ -79,7 +79,9 @@ Description: ==============
}
}
- After::
+ After:
+
+ .. code-block:: python
import environ
root = environ.Path(__file__) - 3 # three folder back (/a/b/c/ - 3 = /)
@@ -110,8 +112,11 @@ Description: ==============
'redis': env.cache('REDIS_URL')
}
- You can also pass `read_env()` an explicit path to the .env file.
- Create a `.env` file::
+ You can also pass ``read_env()`` an explicit path to the ``.env`` file.
+
+ Create a ``.env`` file:
+
+ .. code-block:: bash
DEBUG=on
# DJANGO_SETTINGS_MODULE=myapp.settings.dev
@@ -119,7 +124,7 @@ Description: ==============
DATABASE_URL=psql://urser:un-githubbedpassword@127.0.0.1:8458/database
# SQLITE_URL=sqlite:///my-local-sqlite.db
CACHE_URL=memcache://127.0.0.1:11211,127.0.0.1:11212,127.0.0.1:11213
- REDIS_URL=rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
+ REDIS_URL=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
How to install
@@ -133,9 +138,9 @@ Description: ==============
How to use
==========
- There are only two classes, `environ.Env` and `environ.Path`
+ There are only two classes, ``environ.Env`` and ``environ.Path``
- ::
+ .. code-block:: python
>>> import environ
>>> env = environ.Env(
@@ -165,6 +170,9 @@ Description: ==============
'/home/myproject/static'
+ See `cookiecutter-django`_ for a concrete example on using with a django project.
+
+
Supported Types
===============
@@ -175,7 +183,8 @@ Description: ==============
- json
- list (FOO=a,b,c)
- tuple (FOO=(a,b,c))
- - dict (BAR=key=val,foo=bar)
+ - dict (BAR=key=val,foo=bar) #environ.Env(BAR=(dict, {}))
+ - dict (BAR=key=val;foo=1.1;baz=True) #environ.Env(BAR=(dict(value=unicode, cast=dict(foo=float,baz=bool)), {}))
- url
- path (environ.Path)
- db_url
@@ -185,6 +194,8 @@ Description: ==============
- MySQL for GeoDjango: mysqlgis://
- SQLITE: sqlite://
- SQLITE with SPATIALITE for GeoDjango: spatialite://
+ - Oracle: oracle://
+ - Redshift: redshift://
- LDAP: ldap://
- cache_url
- Database: dbcache://
@@ -209,6 +220,43 @@ Description: ==============
- LocMem mail: memorymail://
- Dummy mail: dummymail://
+ Tips
+ ====
+
+ Using unsafe characters in URLs
+ -------------------------------
+
+ In order to use unsafe characters you have to encode with ``urllib.parse.encode`` before you set into ``.env`` file.
+
+ .. code-block::
+
+ DATABASE_URL=mysql://user:%23password@127.0.0.1:3306/dbname
+
+
+ See https://perishablepress.com/stop-using-unsafe-characters-in-urls/ for reference.
+
+ Email settings
+ --------------
+
+ In order to set email configuration for django you can use this code:
+
+ .. code-block:: python
+
+ EMAIL_CONFIG = env.email_url(
+ 'EMAIL_URL', default='smtp://user@:password@localhost:25')
+
+ vars().update(EMAIL_CONFIG)
+
+
+ SQLite urls
+ -----------
+
+ SQLite connects to file based databases. The same URL format is used, omitting the hostname,
+ and using the "file" portion as the filename of the database.
+ This has the effect of four slashes being present for an absolute
+ file path: sqlite:////full/path/to/your/database/file.sqlite.
+
+
Tests
=====
@@ -222,13 +270,30 @@ Description: ==============
License
=======
- Django-environ is licensed under the MIT License - see the `LICENSE`_ file for details
+ Django-environ is licensed under the MIT License - see the `LICENSE_FILE`_ file for details
Changelog
=========
- `0.4.0 - 23-September-2015 <http://github.com/joke2k/django-environ/compare/v0.3...v0.4>`__
- -------------------------------------------------------------------------------------------
+ `0.4.2 - 13-April-2017 <https://github.com/joke2k/django-environ/compare/v0.4.1...v0.4.2>`__
+ --------------------------------------------------------------------------------------------
+
+ - Confirm support for Django 1.11.
+ - Support for Redshift database URL
+ - Fix uwsgi settings reload problem (#55)
+ - Update support for django-redis urls (#109)
+
+ `0.4.1 - 13-November-2016 <https://github.com/joke2k/django-environ/compare/v0.4...v0.4.1>`__
+ ---------------------------------------------------------------------------------------------
+ - Fix for unsafe characters into URLs
+ - Clarifying warning on missing or unreadable file. Thanks to @nickcatal
+ - Add support for Django 1.10.
+ - Fix support for Oracle urls
+ - Fix support for django-redis
+
+
+ `0.4.0 - 23-September-2015 <https://github.com/joke2k/django-environ/compare/v0.3...v0.4>`__
+ --------------------------------------------------------------------------------------------
- Fix non-ascii values (broken in Python 2.x)
- New email schemes - smtp+ssl and smtp+tls (smtps would be deprecated)
- redis_cache replaced by django_redis
@@ -236,8 +301,8 @@ Description: ==============
- Add LDAP url support for database (django-ldapdb)
- Fix psql/pgsql url
- `0.3 - 03-June-2014 <http://github.com/joke2k/django-environ/compare/v0.2.1...v0.3>`__
- --------------------------------------------------------------------------------------
+ `0.3 - 03-June-2014 <https://github.com/joke2k/django-environ/compare/v0.2.1...v0.3>`__
+ ---------------------------------------------------------------------------------------
- Add cache url support
- Add email url support
- Add search url support
@@ -302,6 +367,8 @@ Description: ==============
.. _Distribute: http://pypi.python.org/pypi/distribute
.. _`modern-package-template`: http://pypi.python.org/pypi/modern-package-template
+ .. _cookiecutter-django: https://github.com/pydanny/cookiecutter-django
+
.. |pypi| image:: https://img.shields.io/pypi/v/django-environ.svg?style=flat-square&label=version
:target: https://pypi.python.org/pypi/django-environ
:alt: Latest version released on PyPi
@@ -318,23 +385,29 @@ Description: ==============
:target: https://ci.appveyor.com/project/joke2k/django-environ
:alt: Build status of the master branch on Windows
- .. |downloads| image:: https://img.shields.io/pypi/dm/django-environ.svg?style=flat-square
- :target: https://pypi.python.org/pypi/django-environ
- :alt: Monthly downloads
-
.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
:target: https://raw.githubusercontent.com/joke2k/django-environ/master/LICENSE.txt
:alt: Package license
- .. _LICENSE: https://github.com/joke2k/django-environ/blob/master/LICENSE.txt
+ .. _LICENSE_FILE: https://github.com/joke2k/django-environ/blob/master/LICENSE.txt
-Keywords: d,j,a,n,g,o, ,e,n,v,i,r,o,n,m,e,n,t, ,v,a,r,i,a,b,l,e,s, ,1,2,f,a,c,t,o,r
+Keywords: django environment variables 12factor
Platform: any
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Information Technology
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
+Classifier: Framework :: Django :: 1.11
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: MIT License
diff --git a/django_environ.egg-info/SOURCES.txt b/django_environ.egg-info/SOURCES.txt
index 8da7bc5..1ed72e0 100644
--- a/django_environ.egg-info/SOURCES.txt
+++ b/django_environ.egg-info/SOURCES.txt
@@ -11,4 +11,8 @@ django_environ.egg-info/requires.txt
django_environ.egg-info/top_level.txt
environ/__init__.py
environ/environ.py
-environ/test.py
\ No newline at end of file
+environ/test.py
+environ/test_env.txt
+environ/tests/__init__.py
+environ/tests/functional_tests.py
+environ/tests/test_environment.py
\ No newline at end of file
diff --git a/django_environ.egg-info/requires.txt b/django_environ.egg-info/requires.txt
index a8bfc44..2b509cb 100644
--- a/django_environ.egg-info/requires.txt
+++ b/django_environ.egg-info/requires.txt
@@ -1,2 +1,2 @@
django
-six
\ No newline at end of file
+six
diff --git a/environ/environ.py b/environ/environ.py
index ca07f93..24368b3 100644
--- a/environ/environ.py
+++ b/environ/environ.py
@@ -15,14 +15,13 @@ except ImportError:
class ImproperlyConfigured(Exception):
pass
-from six.moves import urllib_parse as urlparse
+from six.moves import urllib
from six import string_types
+logger = logging.getLogger(__name__)
-logger = logging.getLogger(__file__)
-
-VERSION = '0.4.0'
+VERSION = '0.4.3'
__author__ = 'joke2k'
__version__ = tuple(VERSION.split('.'))
@@ -31,6 +30,20 @@ __version__ = tuple(VERSION.split('.'))
def _cast_int(v):
return int(v) if hasattr(v, 'isdigit') and v.isdigit() else v
+def _cast_urlstr(v):
+ return urllib.parse.unquote_plus(v) if isinstance(v, str) else v
+
+# back compatibility with redis_cache package
+DJANGO_REDIS_DRIVER = 'django_redis.cache.RedisCache'
+DJANGO_REDIS_CACHE_DRIVER = 'redis_cache.RedisCache'
+
+REDIS_DRIVER = DJANGO_REDIS_DRIVER
+try:
+ import redis_cache
+ REDIS_DRIVER = DJANGO_REDIS_CACHE_DRIVER
+except:
+ pass
+
class NoValue(object):
@@ -50,9 +63,10 @@ class Env(object):
...
"""
+ ENVIRON = os.environ
NOTSET = NoValue()
BOOLEAN_TRUE_STRINGS = ('true', 'on', 'ok', 'y', 'yes', '1')
- URL_CLASS = urlparse.ParseResult
+ URL_CLASS = urllib.parse.ParseResult
DEFAULT_DATABASE_ENV = 'DATABASE_URL'
DB_SCHEMES = {
'postgres': 'django.db.backends.postgresql_psycopg2',
@@ -63,6 +77,8 @@ class Env(object):
'mysql': 'django.db.backends.mysql',
'mysql2': 'django.db.backends.mysql',
'mysqlgis': 'django.contrib.gis.db.backends.mysql',
+ 'oracle': 'django.db.backends.oracle',
+ 'redshift': 'django_redshift_backend',
'spatialite': 'django.contrib.gis.db.backends.spatialite',
'sqlite': 'django.db.backends.sqlite3',
'ldap': 'ldapdb.backends.ldap',
@@ -77,10 +93,10 @@ class Env(object):
'locmemcache': 'django.core.cache.backends.locmem.LocMemCache',
'memcache': 'django.core.cache.backends.memcached.MemcachedCache',
'pymemcache': 'django.core.cache.backends.memcached.PyLibMCCache',
- 'rediscache': 'django_redis.cache.RedisCache',
- 'redis': 'django_redis.cache.RedisCache',
+ 'rediscache': REDIS_DRIVER,
+ 'redis': REDIS_DRIVER,
}
- _CACHE_BASE_OPTIONS = ['TIMEOUT', 'KEY_PREFIX', 'VERSION', 'KEY_FUNCTION']
+ _CACHE_BASE_OPTIONS = ['TIMEOUT', 'KEY_PREFIX', 'VERSION', 'KEY_FUNCTION', 'BINARY']
DEFAULT_EMAIL_ENV = 'EMAIL_URL'
EMAIL_SCHEMES = {
@@ -170,7 +186,7 @@ class Env(object):
"""
:rtype: urlparse.ParseResult
"""
- return self.get_value(var, cast=urlparse.urlparse, default=default, parse_default=True)
+ return self.get_value(var, cast=urllib.parse.urlparse, default=default, parse_default=True)
def db_url(self, var=DEFAULT_DATABASE_ENV, default=NOTSET, engine=None):
"""Returns a config dictionary, defaulting to DATABASE_URL.
@@ -246,7 +262,7 @@ class Env(object):
cast = var_info
try:
- value = os.environ[var]
+ value = self.ENVIRON[var]
except KeyError:
if default is self.NOTSET:
error_msg = "Set the {0} environment variable".format(var)
@@ -322,7 +338,7 @@ class Env(object):
@classmethod
def db_url_config(cls, url, engine=None):
"""Pulled from DJ-Database-URL, parse an arbitrary Database URL.
- Support currently exists for PostgreSQL, PostGIS, MySQL and SQLite.
+ Support currently exists for PostgreSQL, PostGIS, MySQL, Oracle and SQLite.
SQLite connects to file based databases. The same URL format is used, omitting the hostname,
and using the "file" portion as the filename of the database.
@@ -330,7 +346,7 @@ class Env(object):
>>> from environ import Env
>>> Env.db_url_config('sqlite:////full/path/to/your/file.sqlite')
- {'ENGINE': 'django.db.backends.sqlite3', 'HOST': None, 'NAME': '/full/path/to/your/file.sqlite', 'PASSWORD': None, 'PORT': None, 'USER': None}
+ {'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': '/full/path/to/your/file.sqlite', 'PASSWORD': '', 'PORT': '', 'USER': ''}
>>> Env.db_url_config('postgres://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5431/d8r82722r2kuvn')
{'ENGINE': 'django.db.backends.postgresql_psycopg2', 'HOST': 'ec2-107-21-253-135.compute-1.amazonaws.com', 'NAME': 'd8r82722r2kuvn', 'PASSWORD': 'wegauwhgeuioweg', 'PORT': 5431, 'USER': 'uf07k1i6d8ia0v'}
@@ -345,13 +361,13 @@ class Env(object):
'NAME': ':memory:'
}
# note: no other settings are required for sqlite
- url = urlparse.urlparse(url)
+ url = urllib.parse.urlparse(url)
config = {}
# Remove query strings.
path = url.path[1:]
- path = path.split('?', 2)[0]
+ path = urllib.parse.unquote_plus(path.split('?', 2)[0])
# if we are using sqlite and we have no path, then assume we
# want an in-memory database (this is the behaviour of sqlalchemy)
@@ -364,16 +380,27 @@ class Env(object):
# Update with environment configuration.
config.update({
- 'NAME': path,
- 'USER': url.username,
- 'PASSWORD': url.password,
- 'HOST': url.hostname,
- 'PORT': _cast_int(url.port),
+ 'NAME': path or '',
+ 'USER': _cast_urlstr(url.username) or '',
+ 'PASSWORD': _cast_urlstr(url.password) or '',
+ 'HOST': url.hostname or '',
+ 'PORT': _cast_int(url.port) or '',
})
+ if url.scheme == 'oracle' and path == '':
+ config['NAME'] = config['HOST']
+ config['HOST'] = ''
+
+ if url.scheme == 'oracle':
+ # Django oracle/base.py strips port and fails on non-string value
+ if not config['PORT']:
+ del(config['PORT'])
+ else:
+ config['PORT'] = str(config['PORT'])
+
if url.query:
config_options = {}
- for k, v in urlparse.parse_qs(url.query).items():
+ for k, v in urllib.parse.parse_qs(url.query).items():
if k.upper() in cls._DB_BASE_OPTIONS:
config.update({k.upper(): _cast_int(v[0])})
else:
@@ -399,7 +426,7 @@ class Env(object):
:param backend:
:return:
"""
- url = urlparse.urlparse(url) if not isinstance(url, cls.URL_CLASS) else url
+ url = urllib.parse.urlparse(url) if not isinstance(url, cls.URL_CLASS) else url
location = url.netloc.split(',')
if len(location) == 1:
@@ -410,19 +437,27 @@ class Env(object):
'LOCATION': location,
}
+ # Add the drive to LOCATION
if url.scheme == 'filecache':
config.update({
'LOCATION': url.netloc + url.path,
})
- if url.path and url.scheme in ['memcache', 'pymemcache', 'rediscache']:
... 618 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-environ.git
More information about the Python-modules-commits
mailing list