Example #1
0
#!/usr/bin/env python
# coding=utf8

import os
from flask import Flask, render_template, request
from flask.ext.bootstrap import Bootstrap
import useragent

app = Flask(__name__)
Bootstrap(app)

app.config["BOOTSTRAP_USE_MINIFIED"] = True
app.config["BOOTSTRAP_USE_CDN"] = False
app.config["BOOTSTRAP_FONTAWESOME"] = True
app.config["BOOTSTRAP_GOOGLE_ANALYTICS_ACCOUNT"] = "UA-36835748-1"


@app.route("/")
def index():
    ua = useragent.detect(str(request.user_agent))
    os = detectOS(ua)
    return render_template("index.html")


@app.route("/about/")
def about():
    return render_template("about.html")


def detectOS(ua):
    os_string = ua.os.family.lower()