在环境变量中设置Django密钥由于特殊的字符而失败

时间:2021-12-19 12:33:41

I'm trying to set a Django secret key as a local environment variable in my venv/bin/activate.

我试图将Django秘密密钥设置为venv/bin/activate中的本地环境变量。

But the key has a "(" in it and I get a venv error -bash: venv/bin/activate: line 85: syntax error near unexpected token ')'

但是这个键有一个"("在里面我得到了一个venv错误-bash: venv/bin/activate:第85行:语法错误接近意外令牌')"

I'm a bit stuck here. How can I set this Key as a local environment variable so that it accepts these special characters?

我被困在这里了。如何将此键设置为本地环境变量,以便它接受这些特殊字符?

1 个解决方案

#1


1  

Surround the string with single or double quotes. For longer strings (more than one line), you can use single or double quotes in sets of three. For more information and examples, refer to http://docs.python.org/release/2.5.2/ref/strings.html.

用单引号或双引号将字符串括起来。对于较长的字符串(多于一行),您可以在三个一组中使用单引号或双引号。有关更多信息和示例,请参阅http://docs.python.org/release/2.5.2/ref/strings.html。

#1


1  

Surround the string with single or double quotes. For longer strings (more than one line), you can use single or double quotes in sets of three. For more information and examples, refer to http://docs.python.org/release/2.5.2/ref/strings.html.

用单引号或双引号将字符串括起来。对于较长的字符串(多于一行),您可以在三个一组中使用单引号或双引号。有关更多信息和示例,请参阅http://docs.python.org/release/2.5.2/ref/strings.html。