skip to navigation
skip to content

Not Logged In

Flask-Staticify 0.1.2

Looks for static files in the additional locations as a fallback

Latest Version: 0.2.2

A simple extension that makes it possible to define the additional static locations your Flask application will traverse as a fallback.

Only works when app.debug is set to True.

Usage

Let's have an example from the scratch:

>>> from flask.ext.staticify import mount_folders
>>> app.debug = True

# Ah, snap!
>>> app.test_client().get('/static/app.js')
<Response [404]>

>>> STATICIFY_FOLDERS = (
...    os.path.join(app.root_path, 'tmp'),
...    ('prefix', 'path/to/folder')
>>> )
# Mounting will override the endpoint='static' view function
# to look also into the additional folders as a fallback.
>>> mount_folders(app, STATICIFY_FOLDERS)

# And that's it!
>>> app.test_client().get('/static/app.js')
<Response [200]>

API

mount_folders(app, folders)

A single top-level function where the all magic comes from.

folders
an iterable of strings with the additional static locations. It also accepts a tuple of the form (prefix, folder) and using a prefix is a way to connect specific urls with a folder directly.

Install

$ pip install Flask-Staticify
 
File Type Py Version Uploaded on Size
Flask-Staticify-0.1.2.tar.gz (md5) Source 2014-01-17 2KB
  • Downloads (All Versions):
  • 18 downloads in the last day
  • 106 downloads in the last week
  • 574 downloads in the last month