Aleksandre Bregadze
Aleksandre Bregadze

Reputation: 339

Customize django behavior on requests from mobile app and any sort of web browser

Good day,

So I have made a mobile Android/IOS app that communicates with django backend through the http requests. As you understand the backend is hosted on some https://www.example.com domain...
However, in case a user accesses that domain or any extensions (/home, /profile and etc..) from any web browser from any platform, I want to display just a plain page (maybe the name of the app). How can I do so?

Thanks

Upvotes: 0

Views: 142

Answers (1)

PTomasz
PTomasz

Reputation: 1708

If you don't want to add new middleware you can add this in your base.html template. Other way would be to write separate middleware in which you check user_agent and redirect to specific page containing your app name

{% if request.user_agent.is_mobile %}
    NAME OF YOUR APP
{% else %}
    Normal page
{% endif %}

Upvotes: 1

Related Questions