Connecting to heroku and how to code for it with c9



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

1st Question

from urllib.parse import urlparse


I get this

Traceback (most recent call last):
File “”, line 9, in
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:

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?