<div dir="ltr">From the information you have provided, I guess you could just <div>write a function receiving path string to return the path for any template</div><div>you want to include. By request.MOBILE, this function can determine </div><div>to return whether mobile or desktop template path for that particular </div><div>template. For example:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">import os<br>from flask import request, app<br>def assemble_template_path(path):<br>    if request.MOBILE:<br>        return os.path.join(app.config['MOBILE_TEMPLATE_PREFIX'], path)<br>    else:<br>        # Do not append anything if it's on desktop<br>        return path</blockquote></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Best regards,<div>Ares Ou</div><div><br></div><div><b>Software Engineer / Full-Stack Python Developer</b></div><div><b><br></b></div><div><span style="font-size:12.8px"><b>Blog:</b> </span><a href="http://aresou.net" style="font-size:12.8px" target="_blank">http://aresou.net</a>  |  <span style="font-size:12.8px"><b>Github:</b> </span><a href="https://github.com/aresowj" style="font-size:12.8px" target="_blank">https://github.com/aresowj</a></div><div><span style="font-size:12.8px"><b>Stack Overflow:</b> </span><a href="http://stackoverflow.com/users/5183727/ares-ou" style="font-size:12.8px" target="_blank">http://stackoverflow.com/users/5183727/ares-ou</a></div><div><br></div><div><font color="#ffffff">Ares Ou</font></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Oct 13, 2016 at 1:57 PM, Karsten Goen via Flask <span dir="ltr"><<a href="mailto:flask@python.org" target="_blank">flask@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">hello together,<br>first of all I do not want to use responsive webdesign, so I need two<br>
versions of my website since the mobile website shall become a easy<br>
controllable menu with collapsed menu entries.<br>
I am really stuck how do I tell flask that it should choose the<br>
templates out of the mobile folder when detecting a mobile device. I<br>
already tried this <a rel="noreferrer" href="https://flask-mobility.readthedocs.io/en/latest/" target="_blank">https://flask-mobility.readthe<wbr>docs.io/en/latest/</a><br>
which is very good until that point when you include templates into<br>
your templates. I think I more need some general loader like:<br>
when mobile version-> use this template folder (I would use the same<br>
template names). Would that be the direction to go?<br>
Another option would be to write a backend api and make two different<br>
flask-app for each type of website. I think it would not be a big deal<br>
when using blueprints on the other hand I would prefer one handler in<br>
my current app which is easy to load and easy to remove when things in<br>
the app change.<br>
What you people think? I am open to totally new ideas how to structure<br>
mobile / desktop website? What would be the best way without rewriting<br>
"anything".<br>
<br>
<br>
Cheers</div>
<br>______________________________<wbr>_________________<br>
Flask mailing list<br>
<a href="mailto:Flask@python.org">Flask@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/flask" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/flask</a><br>
<br></blockquote></div><br></div>