You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turbolinks makes following links in your web application faster. For more
information, visit the original rails repo: turbolinks.js.
Installation
To install Flask-Turbolinks, simply:
$ pip install Flask-Turbolinks
Or alternatively if you don't have pip:
$ easy_install Flask-Turbolinks
Usage
To enable turbolinks, you need to put turbolinks.js in the <head> of
your html templates.
The backend flask app should be wrapped with turbolinks:
from flask import Flask
from flask_turbolinks import turbolinks
app = Flask(__name__)
# you app should has a secret key for session
app.secret_key = 'secret'
turbolinks(app)
And everything works now, no more configuration.
Note
You can install the javascript code with component:
$ component install lepture/flask-turbolinks
You can also grab the code from turbolinks.js on GitHub. It is written in CoffeeScript, you can compile it with:
coffee -c turbolinks.js.coffee
Demo
There is a demo in the example directory, start a server and open the
url with Chrome. View the requests with developer tools of Chrome.