is Python PHP polyglot a good design?
<p>We have Python middle-tier for our Web App . Now we need to render 3 different HTMLs...</p>

<ul>
<li>for older browsers (simple read-only interface)</li>
<li>for HTML5 browsers (LOT more complex than older browsers)</li>
<li>for mobile website (simple XHTML-MP)</li>
</ul>

<p>Now, we need to keep the Python middle-tier completely independent of any HTML -- just pure business logic.</p>

<p>So, we think we should use a PHP layer on top of Python to generate these HTMLs. PHP would talk to Python via SOA.</p>

<p>First -- is this a good idea? And if not, can you suggest a better design?</p>

<p>Second, if this is a feasible design -- do you think PHP+Python is good (maintainable) mix. If not, how about replacing the PHP layer by yet another Python layer.</p>

<p>Just remember that our middle-tier needs to be COMPLETELY isolated from any HTML thingy :)</p>

<p>-- <strong><em>UPDATE</em></strong> --</p>

<p>The reason we're inclined to using PHP is...</p>

<ul>
<li>PHP itself is just a template engine embedded into HTML -- and it is SO easy to generate complex HTML with it. On the other hand, Python is more of a general purpose language and generating HTML with it will require us to use a third party library which will entail maintenance/upgrade/security hassles. Generating HTML is a sort of raison d'être for PHP.</li>
<li>Secondly, Python support for Nginx is NOT as good as PHP.</li>
</ul>
