简体   繁体   中英

Best way to store constant data on Google App Engine

I'm making a (quite) simple python web application on GAE. The web app basically, ask user input, do basic calculation, then spew out some question from several module based on previous calculation, do basic calculation, spew out more information to the user.

Now, the problem is

  • The data that need to be fetched is located throughout the constant data (eg, several small part of the whole data)
  • The total whole data is about 100kb, required data per user is about 10 kb.
  • The data is constant, and may be modified (by me).
  • I want to conserve cpu cycle. :-)

So far, I've had been hard coding the data in python string literal separated with some if-elif-else as python module, but it is soo ugly (the data is formatted in HTML and more than one line per data). I could store it in the database but it may required the more cpu cycle and I don't know an easy way to store constant (non user modifiable) on the datastore. Putting it in a file, formatted in XML or something could require even more cpu power on parsing. So what is the best way to store constant data?

将数据存储为源代码中的常量,或存储为在应用程序中打开并从中读取相关数据的数据文件。

Ah... whatever. I use database for that. Used cache. And thinking about denormalizing it even further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM