On Tuesday, 25 June 2013 08:01:19 UTC-3, Jox wrote: > > Hi all, > > as to different content, I mean links in the top bar like login, register, > logout and strings like "welcome $username". > what I'd like to do is, only hit database to get data and render these > pages once and cache the wholepage into redis. > > I've come up with a potential solution but I'm not very sure if it's a > good idea. I really need experienced developers' advice. > the solution is on server side the app only render common parts of these > pages and a piece of javascript code with them. > as to data of every user like who they are or whether they are logged in, > I store them into cookies, then after browser get > the page from my server, the javascript code will get data from cookies > and get the remained rendering job done. this way > every time a request comes into my app, the app figures out the state of > the user and save data into cookie and fetch the > rendered page from redis and sent them together back to users. > > what do you think? or are there better ways to deal with this problem? or > maybe I'm doing it wrong? because I'm new to > web developing, I don't know how popular websites deal with this. Thank > you guys....any tips and helps will be appreciated. > Hey Jox,
You should use templates. Web.py comes with templetor [1], but you can also use jinja2 or mako. [1] http://webpy.org/docs/0.3/templetor -- You received this message because you are subscribed to the Google Groups "web.py" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/webpy. For more options, visit https://groups.google.com/groups/opt_out.
