Skip to main content

A reusable django app that provides locally updated exchange rates to your app

Project description

.. image:: https://travis-ci.org/brightwrite/dj-currencies.svg?branch=master :target: https://travis-ci.org/brightwrite/dj-currencies

Documentation

The full documentation is at https://dj-currencies.readthedocs.io.

Quickstart

version 1.0.0 supports Django 3+ only

For Django 2 support, please use version 0.1.2

Install djcurrencies::

pip install dj-currencies

Add it to your INSTALLED_APPS:

.. code-block:: python

INSTALLED_APPS = (
    ...
    'dj_currencies',
    ...
)

Settings

.. code-block:: python

DJANGO_CURRENCIES = {
    'DEFAULT_BACKEND': 'djmoney_rates.backends.OpenExchangeBackend',
    'OPENEXCHANGE_APP_ID': '',
    'BASE_CURRENCIES': ['USD'],
    'MAX_CACHE_DAYS': 7
}

DEFAULT_BACKEND: The selected backend to sync exchange rates

OPENEXCHANGE_APP_ID: Must be configured if you use OpenExchangeBackend

BASE_CURRENCIES: A list of base currencies to use. At the time of this version, you will only be able to convert currency from any one of the base currency to target currency.

MAX_CACHE_DAYS: Only use the cache within this time limit. If exchange rates was not synced within the time frame, an exception will thrown

.. NOTE:: You will need to have at least "OPENEXCHANGE_APP_ID" configured if you use OpenExchangeBackend

Features

  • open exchange rates integration
  • Extensible backend design, hook your own exchange rate sources
  • Multi base currencies support, no double conversion to lose precision
  • Store historical exchange rates
  • offline currency conversion

Running Tests

Does the code actually work?

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ python runtests.py

History

0.0.1 (2018-04-23) ++++++++++++++++++

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dj-currencies3-1.0.2.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file dj-currencies3-1.0.2.tar.gz.

File metadata

  • Download URL: dj-currencies3-1.0.2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.4

File hashes

Hashes for dj-currencies3-1.0.2.tar.gz
Algorithm Hash digest
SHA256 109586499b452c0da61b8b1c02120aaf68ce1123f789945f375324002af4331c
MD5 aa814545414d8c891173eb67070814de
BLAKE2b-256 b23f84d7345ee0e204927c1af098a48a55d39c7d76144ff8d86360493322bcc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page