Skip to main content

Automatic Django database configuration on Heroku.

Project description

# django-heroku-postgresify

Automatic Django database configuration on Heroku.


![What if configuring PostgreSQL is really easy?](https://github.com/rdegges/django-heroku-postgresify/raw/master/assets/postgresify.jpg)


## Install

To install ``django-heroku-postgresify``, simply run
``pip install django-heroku-postgresify`` and you'll get the latest version
installed automatically.


## Usage

Modify your Django ``settings.py`` file, and set:

``` python
from postgresify import postgresify

DATABASES = postgresify()
```

That's it.

Depending on the Heroku PostgreSQL databases you've got installed, your
``DATABASES`` configuration will automatically be setup to use them.

For example, let's assume you've got the following environment variables set on
Heroku (you can view the list of all environment variables by running ``heroku
config``):

- ``HEROKU_POSTGRESQL_BLUE_URL``
- ``HEROKU_POSTGRESQL_RED_URL``
- ``HEROKU_SHARED_POSTGRESQL_RED_URL``
- ``SHARED_DATABASE_URL``
- ``DATABASE_URL``

Your ``DATABASES`` setting would be:

``` python
DATABASES = {
'default': {
# DATABASE_URL configs here
},
'SHARED': {
# SHARED_DATABASE_URL configs here
},
'BLUE': {
# HEROKU_POSTGRESQL_BLUE_URL configs here
},
'RED': {
# HEROKU_POSTGRESQL_RED_URL configs here
},
'SHARED_RED': {
# HEROKU_SHARED_POSTGRESQL_RED_URL configs here
},
}
```


## References

If you're confused, you should probably read:

- [Heroku's Getting Started Guide](http://devcenter.heroku.com/articles/django)
- [Deploy Django's PostgreSQL Section](http://www.deploydjango.com/postgresql/index.html)


## Tests

[![Build Status](https://secure.travis-ci.org/rdegges/django-heroku-postgresify.png?branch=master)](http://travis-ci.org/rdegges/django-heroku-postgresify)

Want to run the tests? No problem:

``` bash
$ git clone git://github.com/rdegges/django-heroku-postgresify.git
$ cd django-heroku-postgresify
$ python setup.py develop
...
$ pip install -r requirements.txt # Install test dependencies.
$ nosetests
.............
----------------------------------------------------------------------
Ran 13 tests in 0.166s

OK
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-heroku-postgresify-0.3.tar.gz (75.0 kB view details)

Uploaded Source

File details

Details for the file django-heroku-postgresify-0.3.tar.gz.

File metadata

File hashes

Hashes for django-heroku-postgresify-0.3.tar.gz
Algorithm Hash digest
SHA256 b686916081741199781e49b539b3a98f14fff2d569b42a41f89d8f0af76e7911
MD5 cdb306bc03fac7f4a4d1d6aa30615eab
BLAKE2b-256 d6e2ef3b73543dd3dd09f3b8f1438bc8d64df2de83d0b701120aadbdb3afa0c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page