由于特殊字符,在环境变量中设置Django密钥失败 [英] Setting Django secret key in environment variable fails due to special character

查看:132
本文介绍了由于特殊字符,在环境变量中设置Django密钥失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的 venv / bin / activate 中设置一个Django密钥作为本地环境变量。

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

但是关键字有一个(,并且我得到了一个venv错误 -bash:venv / bin / activate:line 85:syntax error on unexpected token')'

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

我有点卡在这里。如何将此Key设置为本地环境变量,以便它接受这些特殊字符?

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

推荐答案

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

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.

这篇关于由于特殊字符,在环境变量中设置Django密钥失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆