0

I have a Django project. Its routes are:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('projects/', include('projects.urls'))
]

When I was preparing the project for production, I set SECURE_HSTS_SECONDS to 3600 seconds. Right after this, I got this error. I tried to set this variable to 1 second, but It didn't help. Also, I tried to remove this variable, but my app still doesn't work. I also noticed, that when I hit the https://localhost:8000/projects/ route, Django automatically sets HTTP to HTTPS and even when I change HTTPS to HTTP manually, It's still not going to work. However, it works if I change my route to something different, like http://localhost:8000/works/. I already tried to clear cache in google chrome, head to chrome://net-internals/#hsts and delete localhost from security policies. And I even updated my SECRET_KEY. Now I think, the only way to solve this issue is to recreate the project, but I can't do this, because all the data will be deleted. So what am I doing wrong?

0 Answers0