You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi folks,
I'm learning how to use the templates feature with an internationalized application. I found this brilliant little project starlettte-i18n and its example.
But now I'm wondering if it is necessary to instantiate the templates object for every request (performance issue?) or if I can define a module with the templates object and used it in every module with route handlers. For the second suggestion I wonder if I would have any concurrency issue since I need to call a method get_locale which lookup a Contextvar variable.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi folks,
I'm learning how to use the templates feature with an internationalized application. I found this brilliant little project starlettte-i18n and its example.
But now I'm wondering if it is necessary to instantiate the
templates
object for every request (performance issue?) or if I can define a module with the templates object and used it in every module with route handlers. For the second suggestion I wonder if I would have any concurrency issue since I need to call a methodget_locale
which lookup aContextvar
variable.I'd be happy to have some advice on it 🙂
Beta Was this translation helpful? Give feedback.
All reactions