I have a bunch of string and integer constants that I use at various places in my app. I am planning to put them up in a centralized location, so that it is easier to change them in the future. I could think of the following approaches:
1) Have them as individual variables, stored in the model db.py
settings_title = "My Amazing App"
settings_ver = 2.0
settings_desc = "Moar and Moar cats"
2) Have them as a dict, stored in db.py
settings = { "title": "My Amazing App",
"ver" = 2.0,
"desc" = "Moar and Moar cats"
}
- Is it a good idea to use the model
db.py
? I've heard that it is evaluated for every request. Could putting settings there have a noticeable overhead? - Is there any difference, performance-wise between the two approaches?
- Is there a better way of doing this?