I am using Bottle with the bottle-peewee plugin. In my root
__init__.py I initialise my `db` variable to:
`PeeweePlugin(environ['RDBMS_URI'])`.
Peewee-SQL is giving me a "connection already closed" message when:
0) bottle is started
1) database server is stopped
2) model endpoint hit
3) error thrown
4) database server started
5) model endpoint hit
6) "connection already closed" error thrown
Currently I can catch the `peewee.InterfaceError` exception, and once
I'm there I try running:
global db
db = PeeweePlugin(environ['RDBMS_URI'])
But that doesn't remove the error.
Is there some trick to re-establishing the connection to Postgres, or
otherwise reinitialising the application?
Thanks for all suggestions
--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I believe the problem lies in how you've structured your imports and the way python loads and caches modules in sys.path.
I think that one of your modules is being imported and loaded twice and different parts of the codebase use different instances of the module.
Thus, the views in foo.routes, are using one instance of the database object, while the connection hooks are using another.