I have a problem with my Django code :
I tried this :
requests.post('https://localhost:8000/api/test/', data=data, headers={'Content-Type': 'application/json'}, verify=False)
But I got this :
{SSLError}HTTPSConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /api/test/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852)'),))
I achieved to solve the problem using HTTP instead of https but I want to use https.
How can I do this knowing that all of this is on the localhost ?
Thank you very much!
EDIT :
Here is the urls.py from the api app :
from django.urls import path, include
from django.views.decorators.csrf import csrf_exempt
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token
from API import views as API views
app_name = 'api'
from API.views import LoginViewCustom
urlpatterns = [
path('test/', apiviews.Test.as_view(), name='test')
]
and in the other urls.py :
urlpatterns = [path('api/', include('api.urls', namespace='api'))]