通过从apilayer.com缓存api,免费提供美元/{currency}utils
django-usd2currenc的Python项目详细描述
将价值从美元转换为货币
简单而免费的2美元货币转换实用程序, 通过缓存来自apilayer.com的免费受限api
快速启动
- 安装::
pip install django-usd2currency
- 将“django_usd2currency”添加到已安装的_应用程序设置中,如下所示:
INSTALLED_APPS = [
...
'django_usd2currency',
]
# Get free api from https://currencylayer.com/signup/free
APILAYER_ACCESS_KEY = 'xxxxxxxxxxx'
- 开始在代码中使用它
from django_usd2currency.utils import usd2currency
print(usd2currency(12, currency='CNY'))
- 使用redis as cache backend锁定多进程环境。
待办事项:
- 编写测试