Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Currency, exchange rate and conversions support for django projects

Project Description


django-simple-currencies allows you to define different currencies, and includes template tags / filters to allow easy conversion between them.

[![Latest Version](](

## Setup

Either clone this repository into your project, or install with ```pip install django-simple-currencies```

You'll need to add ```currencies``` to ```INSTALLED_APPS``` in your project's ```` file :


Add ```currencies.middleware.CurrencyMiddleware``` to ```MIDDLEWARE_CLASSES```, must be after ```django.contrib.sessions.middleware.SessionMiddleware``` :

'currencies.middleware.CurrencyMiddleware', # must be after 'SessionMiddleware'

If you're going to use site-wide caching, add ```currencies.middleware.CacheCurrencyMiddleware```, but before ```django.middleware.cache.FetchFromCacheMiddleware``` :

'currencies.middleware.CacheCurrencyMiddleware', # must be before 'FetchFromCacheMiddleware'

Be sure you have the `django.core.context_processors.request` context processor listed in ```TEMPLATE_CONTEXT_PROCESSORS``` :


And don't forget to add this line to your site's root URLConf :

url(r'^currencies/', include('currencies.urls')),

Then run ```./ syncdb``` to create the required database tables

## Configuration

django-simple-currencies has built-in integration with [Open Exchange Rates](

You will need to specify your API key in your `````` file :

OPENEXCHANGERATES_APP_ID = "c2b2efcb306e075d9c2f2d0b614119ea"

You will then be able to use the management commands ``currencies`` and ``update_rates``. The former will import any currencies that are defined on [Open Exchange Rates]( You can selectively import currencies, for example bellow command will import USD and EUR currencies only :

./ currencies --import=USD --import=EUR

The ``update_rates`` management command will update all your currencies against the rates returned by [Open Exchange Rates]( Any missing currency will be left untouched.

## Usage

First of all, load the ```currencies``` in every template where you want to use it :

{% load currencies %}

to get a list of the active currencies :

{% get_currencies as CURRENCIES %}

to get the currently set currency :

{% get_current_currency as CURRENCY %}

and then to convert to a given currency :

{% change_currency [amount] [currency_code] %}

or use the filter :

{{ [amount]|currency:[currency_code] }}

Please see ```example``` application. This application is used to manually test the functionalities of this package. This also serves as a good example.

You need only Django 1.4 or above to run that. It might run on older versions but that is not tested.

Release History

This version
History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(11.4 kB) Copy SHA256 Hash SHA256
Source None Apr 14, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting