Flask-Staticify-0.2.2
توضیحات
Looks for static files in the additional locations as a fallback
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | Flask-Staticify-0.2.2 |
| نام | Flask-Staticify |
| نسخه کتابخانه | 0.2.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Maxim Stolyarchuk |
| ایمیل نویسنده | maxim.stolyarchuk@gmail.com |
| آدرس صفحه اصلی | https://github.com/mstolyarchuk/flask-staticify |
| آدرس اینترنتی | https://pypi.org/project/Flask-Staticify/ |
| مجوز | BSD |
Flask-Staticify
===============
A simple extension that makes it possible to define the additional static locations
your Flask application will traverse as a fallback. Miss Django's ``STATICFILES_DIRS`` setting?
This mimics that functionallty.
Only works when ``app.debug`` is set to ``True``.
Usage
-----
Let's have an example from the scratch:
.. code:: python
>>> 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*, *locations*)
`````````````````````````````````
A single top-level function where the all magic comes from.
locations
an iterable of strings with the additional static locations. It also accepts a 2-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
نحوه نصب
نصب پکیج whl Flask-Staticify-0.2.2:
pip install Flask-Staticify-0.2.2.whl
نصب پکیج tar.gz Flask-Staticify-0.2.2:
pip install Flask-Staticify-0.2.2.tar.gz