[使用PYCHARM]
我正在尝试使用.env
在settings.py
中使用python-decouple
文件的详细信息。 decouple
完美安装,但是当我尝试导入它时,它发出警告:Package containing module 'decouple' is not listed in project requirements
。
您可以从此处查看软件包的详细信息:
https://pypi.org/project/python-decouple/3.1/
warning i'm getting while importing decouple
终端错误:raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))
decouple.UndefinedValueError: EMAIL_BACKEND not found. Declare it as envvar or define a default value.
.env
文件
export EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
export EMAIL_HOST=smtp.gmail.com
export [email protected]
export EMAIL_USE_TLS=True
export EMAIL_PORT=587
export EMAIL_HOST_PASSWORD=xxxxxxxxx;
settings.py
EMAIL_BACKEND = config('EMAIL_BACKEND')
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_USE_TLS = config('EMAIL_USE_TLS')
EMAIL_PORT = config('EMAIL_PORT')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
我尝试创建requirements.txt,并在其中添加了python-decouple==3.3
,但仍然无法正常工作。
我正在使用pipenv
软件包的另一件事是问题所在?