Connecting to heroku and how to code for it with c9

heroku
postgresql
python

#1

I am trying to connect my python app postgre to heroku with python3.
I am following these links


community.c9.io/t/connecting-to-postgres-database-on-heroku/9991/8

1st Question

from urllib.parse import urlparse

urlparse.uses_netloc.append(“postgres”)

I get this

Traceback (most recent call last):
File “filename.py”, line 9, in
urlparse.uses_netloc.append(“postgres”)
AttributeError: ‘function’ object has no attribute ‘uses_netloc’

I have tried installing urlparse3 and i get the same error. So the import is done, but error in the function. Not sure what i am missing

2nd Question:

urlparse.uses_netloc.append(“postgres”)
url = urlparse.urlparse(os.environ[“DATABASE_URL”])

DATABASE_URL i understand should be the one we find in the heroku config.
How then do we structure our code for the c9 local database as well? Where do i find the database_url in c9? Or is there no need? Just use the pg: push and pull and it will work?

Thanks!