hivesolutions / appier

Joyful Python Web App development
http://appier.hive.pt
Apache License 2.0
127 stars 22 forks source link

App instance retrieval on a per-thread basis #8

Open joamag opened 8 years ago

joamag commented 8 years ago

Description

While using Appier it's important to keep in mind that many features of it use the concept of global variable to simplify the usage process.

These same global variables may created weird runtime issues while running the App, mainly while running multiple Apps in the same process.

To avoid some of thoses issues a per-thread association should be created between an App and the thread where it's container (web server) is running.

Solutions

The start() and stop() method of an app are called "inside" the web server container and should be used for this kind of registration.