Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

To generate avatar for flask

Project description

:Author: jianglin

.. contents::

1 flask-avatar

.. image::
.. image::
.. image::
:target: LICENSE

1.1 Example

.. image:: //

.. image:: //

.. image:: //

1.2 Installation

To install Flask-Avatar:

.. code:: shell

pip install flask-avatar

Or alternatively, you can download the repository and install manually by doing:

.. code:: sehll

git clone
cd flask-avatar
python install

1.3 Usage

.. code:: python

from flask_avatar import Avatar
# or use cachefunc
Avatar(app, cache=cachefunc)

**cachefunc** must be a decorator:

.. code:: python

def cachefunc(func):
def _cache(*args, **kwargs):
r = cacheclient.get("cache key")
if r is not None:
return r
return func(*args, **kwargs)
return _cache


.. code:: html

{{ url_for('avatar',text = user.username )}}

or set **width** with:

.. code:: html

{{ url_for('avatar',text = user.username,width=60)}}

1.4 Config

.. code:: python

AVATAR_URL = '/avatar' #The avatar url,default '/avatar/<text>/<width>'
AVATAR_RANGE = [0,512] #set avatar range to allow generate,if disallow,abort(404).Default [0,512]

1.5 Thanks to

` <>`_

Project details

Download files

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

Files for Flask-Avatar, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size Flask-Avatar-0.1.3.tar.gz (2.3 MB) 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