InvalidRequestError: Object is already attached to session

When I created the HWCDI blog app, I followed Miguel’s tutorial.

I started hosting it in ‘production’ and didn’t follow his exact setup instructions.

I’m not running in a venv (bad?)

I also left out a vital note Miguel clearly covered.

I was making my edit blog post page a little more robust,
adding the ability to delete them (the public ones), and save multiple times in a row.

I ran into the issue:
InvalidRequestError: Object is already attached to session

Miguel’s resolution works:
Download his flask_whooshalchemy.py – https://raw.github.com/miguelgrinberg/Flask-WhooshAlchemy/1e17350ea600e247c0094cfa4ae7145f08f4c4a3/flask_whooshalchemy.py
Explanation:
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling

Leave a Reply

Your email address will not be published. Required fields are marked *