30 lines
830 B
Python
30 lines
830 B
Python
from app import app, db
|
|
from flask import render_template, request, redirect, url_for, flash
|
|
from app.models import target
|
|
|
|
@app.route('/')
|
|
def home():
|
|
"""Render website's home page."""
|
|
targets = db.session.query(target).all()
|
|
return render_template('home.html', targets=targets)
|
|
|
|
@app.after_request
|
|
def add_header(response):
|
|
"""
|
|
Add headers to both force latest IE rendering engine or Chrome Frame,
|
|
and also to cache the rendered page for 10 minutes.
|
|
"""
|
|
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
|
|
response.headers['Cache-Control'] = 'public, max-age=600'
|
|
return response
|
|
|
|
|
|
@app.errorhandler(404)
|
|
def page_not_found(error):
|
|
"""Custom 404 page."""
|
|
return render_template('404.html'), 404
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run(debug=True,host="0.0.0.0",port="8080")
|