I'm trying to get a heroku app deployed and unfortunately I am getting the following error. Essentially what the Heroku logs tell you to do to get a heroku database connection is the following (taken from here; https://devcenter.heroku.com/articles/heroku-postgresql)
import os
import psycopg2
import urlparse
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
conn = psycopg2.connect(
database=url.path[1:],
user=url.username,
password=url.password,
host=url.hostname,
port=url.port
)
I started using gunicorn, but I couldn't understand the errors that I was getting because it was spawning like 10 workers, so I switched to waitress and I got the following error (from heroku logs):
2017-07-16T22:21:52.941072+00:00 app[web.1]: Exception in thread Thread-1:
2017-07-16T22:21:52.941072+00:00 app[web.1]: Traceback (most recent call last):
2017-07-16T22:21:52.941073+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/threading.py", line 801, in __bootstrap_inner
2017-07-16T22:21:52.941073+00:00 app[web.1]: self.run()
2017-07-16T22:21:52.941073+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/threading.py", line 754, in run
2017-07-16T22:21:52.941074+00:00 app[web.1]: self.__target(*self.__args, **self.__kwargs)
2017-07-16T22:21:52.941074+00:00 app[web.1]: File "/app/timed/inflation.py", line 28, in inflatemethod
2017-07-16T22:21:52.941075+00:00 app[web.1]: urlparse.uses_netloc.append("postgres")
2017-07-16T22:21:52.941075+00:00 app[web.1]: AttributeError: 'function' object has no attribute 'uses_netloc'
So by default the heroku method that is in the docs is broken! That is bad! I'm not sure how to fix this, does anyone else have any ideas?