1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
# -*- coding: utf-8 -*-
import sys
import os
from flask import (Flask, request, url_for, render_template, make_response)
from werkzeug.useragents import UserAgent
USERNAME = 'admin'
PASSWORD = ''
SERVER_NAME = None
LANGUAGE = 'en'
ROBOTS_TXT = 'Disallow: /login.html'
WEBDIR = os.path.dirname(os.path.abspath('__files__'))
PAGESDIR = os.path.join(os.path.dirname(WEBDIR), 'htdocs/templates')
STATICDIR = os.path.join(os.path.dirname(WEBDIR), 'htdocs/static')
TEMPDIR = os.path.join(os.path.dirname(WEBDIR), 'tmp')
app = Flask(__name__, template_folder=PAGESDIR, static_folder=STATICDIR)
app.config.from_object(__name__)
@app.route('/', methods=['GET'])
def root():
return render_template('home.html')
@app.route('/home', methods=['GET'])
def home():
return render_template('home.html', lang=lang)
@app.route('/downloads', methods=['GET'])
def download():
return render_template('downloads.html')
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@app.route('/robots.txt')
def view_robots_page():
response = make_response()
response.data = ROBOTS_TXT
response.content_type = "text/plain"
return response |
Partager