Search code examples
pythondjangosaleor

Set a secret key with command line in Django for saleor installation on windows


I'm trying to install saleor on Windows, in the SECRET_KEY part throws an error saying that my SECRET_KEY cannot be empty, I suppose it must be entered by commands. What command is used in Windows to set a SECRET_KEY in Django and then continue to the next step of installing saleor?


Solution

  • First, settings.py exist indeed, you will found it inside "saleor" folder where you have cloned the project. In settings.py you'll found:

    SECRET_KEY = os.environ.get("SECRET_KEY")
    

    Which means that you really haven't a secret key setted up. Instead of this it will be capturing it from your environment variables, so here you must setup it:

    Open a command prompt and type: setx SECRET_KEY "<your secret key>" (another method here: https://www.youtube.com/watch?v=bEroNNzqlF4)

    Your secret key can be "hello" if you're just testing, or can generate a "real" key here: https://www.miniwebtool.com/django-secret-key-generator/

    Regards!