Skip to main content

Currency handling extension for Flask and SQLAlchemy

Project description


Currency handling extension for Flask.


###Initialization Initialize extension by providing Flask and Flask-SQLAlchemy instance.

from flask import Flask
from flask_currency import Currency
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
db = SQLAlchemy(app) 
currency = Currency(app, db)

if __name__ == '__main__':

Optionally, an extended currency model can be provided (for translation support, etc.). If the model is not extended, it can be accessed through the Currency.model attribute.

Money class

A money class is defined, which uses the Currency model for value calculation and formatting.

>>> from flask_currency import Money
>>> price = Money(100, 'USD')
>>> print(price)

>>> in_eur = price.convert_to('EUR')
>>> print(in_eur)
'90.71 €'


The currencies table must be maintained, currency data must be added manually.

eur = currency.model(
    format_str='{:,.2f} €'

Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for FlaskCurrency, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size FlaskCurrency-1.0.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page