I believe I am missing a fundamental setup.
I'm trying to test my API using Django's testing framework.
From the shell, I try:
from django.test import Client
c = Client()
r = c.get('/')
I get a 400 Bad Request
, which is not the expected output.
Using a simple curl
from the command line:
curl http://localhost
I get the expected output: {"detail":"Authentication credentials...
Am I missing something basic?
You can use the test client while DEBUG is False, you just need to add 'testserver' into your ALLOWED_HOSTS setting
It looks like:
DEBUG = True
is needed in the settings.py
file for this to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With