[Solved]-Django Test Client and Subdomains

12👍

in your tests, when using the client, add the HTTP_HOST parameter:

response = c.post(reverse('my-url'), data={}, HTTP_HOST='account1.myapp.com')

on your middleware now you should see the host changed!

👤Julian

Leave a comment