I downloaded example code for a Django website. When I ran the server, I encountered the error The SECRET_KEY setting must not be empty. The secret key is set in the settings.py line
SECRET_KEY = os.getenv('SECRET_KEY')
This Stack Overflow post describes this issue and the accepted answer states that the secret key can be any 50 character string, so I used the same secret key as in another of my projects.
SECRET_KEY ='%710m*zic)#0u((qugw#1@e^ty!c)9j04956v@ly(_86n$rg)h'
But when I try to run the server using the command python manage.py runserver I get the error message ‘This site can’t provide a secure connection. 127.0.0.1 sent an invalid response.’
Can someone please help me? Thank you.
Advertisement
Answer
The system environment hides the original secret key of the Django app that you downloaded (Ask the owner of the code for the secret key of it or create your own django app and copy the implementation of the code). The Django secret key cannot be customized. Django generates it automatically.
Refer to question: Effects of changing Django’s SECRET_KEY