Python Web - newgeekorder/TechWiki GitHub Wiki
Back to Home
Api
Dashboard
Flask
Flask can start as simple script/microservice for python webapps
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/test")
def test():
return "Hello World!"
@app.route('/hello')
def index():
user = {'name': 'Richard'} # fake user
return render_template('hello.html',
title='Home',
name='Richard Donovan')
if __name__ == "__main__":
app.debug = True
app.run()
This example will
- run in dev mode auto reloading the script
app.debug = True
- use templates in the
templates
folder
Plugins
- AssetPack: dynamic, object oriented, verified asset blocks for jinja templates.
- Periodic2: local, and global, tracked periodic tasks that can be run on clustered dashboard server instances.
- PluginSystem: which allows bootstrapping arbitrary git repositories into the flask application as plugins, which get their own endpoints, web socket connections, and "window" on the main interface. All web socket connects are multiplexed from the client, and between server instances, so if two plugins on the same page are using the same backend data only a single periodic task is spawned and reported to every client. Periodic tasks are only run while someone is "looking" at them via the interface.
Flask and Javascript binding
Wsgi Web Servers (for Flask etc)
Flask can be deployed to wsgi web servers like:
and can be deployed inside Docker
Charts
Static Sites
Blgging
- Simple a simple blog in Flask
Scraping
Links and Reference
- flask
- flask boost a LAMP type stack for Flask with DB and reload
- flask awesome list