a guest Aug 12th, 2016 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- To use PostgreSQL as your database in Python applications you will need to use the psycopg2 package.
- $ pip install psycopg2
- $ pip freeze > requirements.txt
- And use this package to connect to DATABASE_URL in your code:
- import os
- import psycopg2
- import urlparse
- url = urlparse.urlparse(os.environ["DATABASE_URL"])
- conn = psycopg2.connect(
RAW Paste Data