我在 django 应用程序中设置了静态和媒体根以及 url,如下所示:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
MEDIA_URL = '/crl/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'config/crl/')
Run Code Online (Sandbox Code Playgroud)
它工作得很好,但我想添加另一个 MEDIA_URL 和 MEDIA_ROOT 来提供/certs/目录中的文件,如下所示:
NEW_MEDIA_URL = '/certs/'
NEW_MEDIA_ROOT = os.path.join(BASE_DIR, 'config/certs/')
Run Code Online (Sandbox Code Playgroud)
有什么办法可以做到吗?我正在使用 Django 2.0.6 和 Python 3.5
django django-templates django-models django-views django-media
我.pem使用以下命令使用 openssl生成文件:
openssl genrsa -aes256 -out ca.key.pem 4096
Run Code Online (Sandbox Code Playgroud)
它工作得很好,但是当我这样做时:
openssl genrsa -aes256 -out ca.key.pem 4096 -password pass:abcd
Run Code Online (Sandbox Code Playgroud)
它仍然在终端中要求我输入密码,而不是自动使用提供的密码。
我之前尝试过生成证书,它适用于它们,例如。
openssl pkcs12 -name username -inkey cert/key.key -in abc.pem -export -out cert.p12 -password pass:abcd
Run Code Online (Sandbox Code Playgroud) 我使用以下命令生成根 CA:
openssl genrsa -aes256 -out ca.key.pem -passout pass:KeyPassword 4096
openssl req -key ca.key.pem -passin pass:Password -new -x509 -days 365 -sha256 -out ca.root.pem
Run Code Online (Sandbox Code Playgroud)
然后我使用以下命令创建签名的用户证书(不使用中间证书):
1)为用户生成密钥
openssl req -newkey rsa:2048 -nodes -keyout keyname.pem -days 365
Run Code Online (Sandbox Code Playgroud)
2) 创建企业社会责任
openssl req -out keyname.csr -key keyname.pem -new -days 365
Run Code Online (Sandbox Code Playgroud)
3)使用根证书签署密钥
openssl ca -batch -create_serial -config openssl.cnf -cert ca.root.pem -keyfile ca.key.pem -passin pass:KeyFinalPassword -in keyname.csr -out certname.pem
Run Code Online (Sandbox Code Playgroud)
4) 生成.p12文件
openssl pkcs12 -name username -inkey keyname.pem -in certname.pem -export -out username.p12 -password pass:password
Run Code Online (Sandbox Code Playgroud)
注意 - 我已将 …
ssl openssl certificate certificate-revocation client-certificates
我有一个超过50个元素的列表.这些元素是小写和大写字母,数字,特殊字符.
例如.
sample_list = ['1', '0', 'b', 'B', '2', '6', 'a', '7', '9', '5', 'c', 'd', '4', 'A', 'C', 'f', 'D', 'F', '3', 'C', '8', 'A', 'F', 'B', 'A', 'A', 'D']
Run Code Online (Sandbox Code Playgroud)
我想用特殊字符交换特定元素.例如.
replacing `A,B,C and 1 with @
replacing `D,E,F and 2 with &
replacing `G,H,I and 3 with (
Run Code Online (Sandbox Code Playgroud)
等等,我必须用11个选定的特殊字符替换一组特定的元素.就像我用3个特殊字符替换了几个选中的元素.
如何有效地做到这一点.
openssl ×2
certificate ×1
django ×1
django-media ×1
django-views ×1
encryption ×1
list ×1
pem ×1
python ×1
python-3.x ×1
replacewith ×1
ssl ×1