Redirect site to in django mobile

I want to redirect the user to in my mobile browser. I want to use an existing website, but I'm redirecting to For this, how can I detect that the user is on mobile or desktop. And how can I redirect the mobile version of the same site.

using media screen i can create separate displays for mobile partitions

using bootstrap i can build a responsive website. but when its in the mobile browser i want to redirect the mobile version like

How can i do this? And my site is in django.


source to share

1 answer

You can use something like this: The idea is to detect a mobile device in middleware ( / middleware / ).

So, if the middleware detects this request coming from a mobile device and the user requests a regular version of the site, you can redirect them to the mobile version of the site.



All Articles