Home > Mobile >  Error in running a project regarding virtual environment and "DJANGO_SECRET_KEY" in VS cod
Error in running a project regarding virtual environment and "DJANGO_SECRET_KEY" in VS cod

Time:09-19

I want to run a project from gitlab on my local machine. I cloned the project, created a virtual environment and activated it. When I want to run without debugging I got this error:

File "c:\Users\ME\Desktop\test\z_tool\settings.py", line 28, in <module>
    SECRET_KEY = env.str('DJANGO_SECRET_KEY')
  File "c:\Users\ME\Desktop\test\myenv\lib\site-packages\environs\__init__.py", line 110, in method
    raise EnvError('Environment variable "{}" not set'.format(proxied_key or parsed_key))
environs.EnvError: Environment variable "DJANGO_SECRET_KEY" not set

The output of this project is a form, how can I solve this error to get the output?

CodePudding user response:

There's a good explanation here https://stackoverflow.com/a/47117966/20027268

basically it's used for securing data in a django app, you can get around this for now by setting the DJANGO_SECRET_KEY environment variable to something random for now:

Windows: https://www.tutorialspoint.com/how-to-set-environment-variables-using-powershell

Mac: export [variable_name]=[variable_value]

  • Related