Trying to use Heroku and deploy a project using Postgres..as Heroku only generates Database_URL with Postgres and not PostgreSQL tried the below code suggested by the Heroku community but it is throwing above mentioned error.
uri = os.environ.get("DATABASE_URL") # or other relevant config var
if uri.startswith("postgres://"):
uri = uri.replace("postgres://", "postgresql://", 1)
error " if uri.startswith("postgres://"): AttributeError: 'NoneType' object has no attribute 'startswith' "