This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

XStatic is a means of packaging static files, especially JS libraries, for Python applications. Tornado is a Python web framework.

This integration provides:

  • XStaticFileHandler to serve static files from XStatic packages.
  • xstatic_url ui method to build URLs for XStatic files, including the ?v=... tag that Tornado uses for cache invalidation.

To use these:

import tornado.ioloop
import tornado.web
from tornado_xstatic import XStaticFileHandler, xstatic_url

class MyHandler(tornado.web.RequestHandler):
    def get(self):
        self.render("mytemplate.html")


if __name__ == "__main__":
    application = tornado.web.Application(
        [
            (r"/", MyHandler),
            (r"/xstatic/(.*)", XStaticFileHandler,
                {"allowed_modules": ["jquery", "bootstrap"]}),
        ],
        ui_methods={'xstatic_url': xstatic_url('/xstatic/')}
    )
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

Passing allowed_modules is optional: if it is not provided, files from any XStatic module may be served.

In your template, you can then do this:

<script src="{{ xstatic_url('jquery', 'jquery.min.js') }}"></script>
<script src="{{ xstatic_url('bootstrap', 'js/bootstrap.min.js') }}"></script>

<link href="{{ xstatic_url('bootstrap', 'css/bootstrap.min.css') }}" rel="stylesheet">
Release History

Release History

0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tornado_xstatic-0.2-py2.py3-none-any.whl (3.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Apr 8, 2015

Supported By

WebFaction WebFaction Technical Writing 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 Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting