0

I am new and just start learning flask. In my project, I need all the pages are printed in two languages, say 'LAN_A' and 'LAN_B'. So I need a variant to save it. Now I save it in app.config['language'] = 'LAN_A'/'LAN_B'. When debugging locally, I browse the page by two devices (thus also two IP). In device1, I change the language then I found all the pages in device2 will also be changed(after the setting in device1). It seems understandable since there is only one main.py is running.

My question: Is it because my treatment is inappropriate? or future in the real service, we have some method to let each user run one main.py?

hengyue li
  • 448
  • 3
  • 17

1 Answers1

1

app.config is global. Don't store user-specific configuration there. Likely you'll want to use a cookie or a URL parameter for the display language.

Daniel Pryden
  • 59,486
  • 16
  • 97
  • 135