I have just deployed my django project on dogitalocean (nginx/ubuntu 16.04) server.
In Allowed hosts I added ['.example.com', 'IP']
In the DNS records of my digitalocean droplet I added two A type records one is pointing example.com to the IP, & the second is pointing www.example.com to the same IP.
Problem is that I visited the site as example.com & logged in as a normal user, & then I opened a new tab (still logged in at example.com) & visited site using www as www.example.com & i'm not logged in there.
How can I redirect example.com to www.example.com? Thank You :)