dj-database-url


Namedj-database-url JSON
Version 0.4.2 PyPI version JSON
home_pagehttps://github.com/kennethreitz/dj-database-url
SummaryUse Database URLs in your Django Application.
upload_time2017-01-05 17:47:41
maintainer
docs_urlNone
authorKenneth Reitz
requires_python
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
Coveralis test coverage No Coveralis.
            
dj-database-url
~~~~~~~~~~~~~~~

.. image:: https://secure.travis-ci.org/kennethreitz/dj-database-url.png?branch=master
   :target: http://travis-ci.org/kennethreitz/dj-database-url

This simple Django utility allows you to utilize the
`12factor <http://www.12factor.net/backing-services>`_ inspired
``DATABASE_URL`` environment variable to configure your Django application.

The ``dj_database_url.config`` method returns a Django database connection
dictionary, populated with all the data specified in your URL. There is
also a `conn_max_age` argument to easily enable Django's connection pool.

If you'd rather not use an environment variable, you can pass a URL in directly
instead to ``dj_database_url.parse``.

Supported Databases
-------------------

Support currently exists for PostgreSQL, PostGIS, MySQL, MySQL (GIS),
Oracle, Oracle (GIS), and SQLite.

Installation
------------

Installation is simple::

    $ pip install dj-database-url

Usage
-----

Configure your database in ``settings.py`` from ``DATABASE_URL``::

    import dj_database_url

    DATABASES['default'] = dj_database_url.config(conn_max_age=600)

Provide a default::

    DATABASES['default'] = dj_database_url.config(default='postgres://...'}

Parse an arbitrary Database URL::

    DATABASES['default'] = dj_database_url.parse('postgres://...', conn_max_age=600)

The ``conn_max_age`` attribute is the lifetime of a database connection in seconds
and is available in Django 1.6+. If you do not set a value, it will default to ``0``
which is Django's historical behavior of using a new database connection on each
request. Use ``None`` for unlimited persistent connections.



            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "coveralis": false, 
    "keywords": "", 
    "upload_time": "2017-01-05 17:47:41", 
    "author": "Kenneth Reitz", 
    "home_page": "https://github.com/kennethreitz/dj-database-url", 
    "github_user": "kennethreitz", 
    "download_url": "https://pypi.python.org/packages/c8/4b/b23dbcf4c5711f26e2222bb2e300915c9c8d35e643b0af00c2d8f36c9490/dj-database-url-0.4.2.tar.gz", 
    "platform": "any", 
    "version": "0.4.2", 
    "cheesecake_documentation_id": null, 
    "description": "\ndj-database-url\n~~~~~~~~~~~~~~~\n\n.. image:: https://secure.travis-ci.org/kennethreitz/dj-database-url.png?branch=master\n   :target: http://travis-ci.org/kennethreitz/dj-database-url\n\nThis simple Django utility allows you to utilize the\n`12factor <http://www.12factor.net/backing-services>`_ inspired\n``DATABASE_URL`` environment variable to configure your Django application.\n\nThe ``dj_database_url.config`` method returns a Django database connection\ndictionary, populated with all the data specified in your URL. There is\nalso a `conn_max_age` argument to easily enable Django's connection pool.\n\nIf you'd rather not use an environment variable, you can pass a URL in directly\ninstead to ``dj_database_url.parse``.\n\nSupported Databases\n-------------------\n\nSupport currently exists for PostgreSQL, PostGIS, MySQL, MySQL (GIS),\nOracle, Oracle (GIS), and SQLite.\n\nInstallation\n------------\n\nInstallation is simple::\n\n    $ pip install dj-database-url\n\nUsage\n-----\n\nConfigure your database in ``settings.py`` from ``DATABASE_URL``::\n\n    import dj_database_url\n\n    DATABASES['default'] = dj_database_url.config(conn_max_age=600)\n\nProvide a default::\n\n    DATABASES['default'] = dj_database_url.config(default='postgres://...'}\n\nParse an arbitrary Database URL::\n\n    DATABASES['default'] = dj_database_url.parse('postgres://...', conn_max_age=600)\n\nThe ``conn_max_age`` attribute is the lifetime of a database connection in seconds\nand is available in Django 1.6+. If you do not set a value, it will default to ``0``\nwhich is Django's historical behavior of using a new database connection on each\nrequest. Use ``None`` for unlimited persistent connections.\n\n\n", 
    "lcname": "dj-database-url", 
    "bugtrack_url": "", 
    "github": true, 
    "name": "dj-database-url", 
    "license": "BSD", 
    "travis_ci": true, 
    "github_project": "dj-database-url", 
    "summary": "Use Database URLs in your Django Application.", 
    "split_keywords": [], 
    "author_email": "me@kennethreitz.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-01-05T17:47:41", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/c8/4b/b23dbcf4c5711f26e2222bb2e300915c9c8d35e643b0af00c2d8f36c9490/dj-database-url-0.4.2.tar.gz", 
            "md5_digest": "4395ec2bd618407ba38b2645f2786c1f", 
            "downloads": 0, 
            "filename": "dj-database-url-0.4.2.tar.gz", 
            "packagetype": "sdist", 
            "path": "c8/4b/b23dbcf4c5711f26e2222bb2e300915c9c8d35e643b0af00c2d8f36c9490/dj-database-url-0.4.2.tar.gz", 
            "size": 4268
        }, 
        {
            "has_sig": false, 
            "upload_time": "2017-01-05T17:47:42", 
            "comment_text": "", 
            "python_version": "2.7", 
            "url": "https://pypi.python.org/packages/91/84/50cbfabb91593cff18a37046986f7c2eb69224a694a52ae614711dfa11c6/dj_database_url-0.4.2-py2.py3-none-any.whl", 
            "md5_digest": "b2f129375959cf8cc8ca8b094fda21e3", 
            "downloads": 0, 
            "filename": "dj_database_url-0.4.2-py2.py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "91/84/50cbfabb91593cff18a37046986f7c2eb69224a694a52ae614711dfa11c6/dj_database_url-0.4.2-py2.py3-none-any.whl", 
            "size": 5573
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}