I have a simple application using Flask and MongoEngine and I'm having some trouble maintaining the full functionality on Heroku. I'm not having any errors thrown, but when I actually try to access it, my application throws a 500 error if I try to read from it. This the relevant part of my __init__
file that sets up the connection:
MONGO_URL = os.environ.get("MONGOHQ_URL")
app = Flask(__name__)
if MONGO_URL:
credentials = re.sub(r"(.*?)//(.*?)(@hatch)", r"\2",MONGO_URL)
username = credentials.split(":")[0]
password = credentials.split(":")[1]
app.config["MONGODB_DB"] = MONGO_URL.split("/")[-1]
connect(
MONGO_URL.split("/")[-1],
host=MONGO_URL,
port=1043,
username=username,
password=password
)
The log of the error is this:
heroku[router]: at=info method=GET path=/admin/create/ host=tranquil-taiga-1563.herokuapp.com fwd="66.31.20.171" dyno=web.1 connect=2ms service=8ms status=500 bytes=291
app[web.1]: 10.191.63.167 - - "GET /admin/create/ HTTP/1.1" 500 -
Not quite sure if this is relevant, but the file that actually calls the view (in case my assumption about the source of the error is incorrect)