开发者

Is there a standard way to create a 'preview' mode for a website?

开发者 https://www.devze.com 2023-04-01 08:44 出处:网络
I want to implement a \'preview\' mode to showcase new features to my users (similar to how Google and numerous other sites do it).

I want to implement a 'preview' mode to showcase new features to my users (similar to how Google and numerous other sites do it).

I'm wondering if there's an "industry standard" or best practice for doing this.

To be more specific, say I have two t开发者_开发知识库emplates: template A is the old-looking site, and template B is the new looking site. Both templates/views will have access to the same database...I just want the UI to be different.

For only one or two pages, this is easy enough, but if I have a site with hundreds of templates, I don't want to have to put in conditional code to correctly render the old/new template based on the users' preference.

If it helps, I'm doing this with Django.


I'm a UI Developer, and I get asked to do this all the time. There are ways to run simultaneous "templates" on live sites. However, I recommend NOT doing it. Making development runs at production sites can cause fatal errors, and it's not worth the heartache of taking down two sites because of a silly mistake. And no matter how many times I'm told "I only work on dev and push tested changes to the live server" I know that there is always a chief of something that will tell you to "just make this one change quick before the meeting" that causes the proverbial explosion. The wrath that follows is never fun.

For all my company's development, we've followed three paths. For testing, there's a dedicated test server with fake data in the DB that can be freely futzed with--and blown up at will. For production testing, there's a sandbox server hooked to live data. Finally, there's a production server that ONLY gets properly tested, production code. We do freely share the link to the sandbox server, which is just a domain extension of the other servers....a simple setup in Apache or your server of choice. Combined with proper version and production management, it's a great solution, even in our small shop--In two years, it has NEVER failed us.


Check out my answer to this question: What/Where to modify django-registration to use with mobile broswers

That explains how to have completely different template directory for mobile browsers, very similar to what you are doing.

You can have two template directories, old and new, and use a similar trick to set the TEMPLATE_DIRS based upon a profile or even session variable. You can also restrict the TEMPLATE_DIRS reset to a limited number of paths etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号