from flask import Flask, render_template, flash, request, redirect, url_for, session, logging from data import articles from wtforms import Form, StringField, TextAreaField, PasswordField, validators import rsp_final #import requests app = Flask(__name__) articles = articles() @app.route('/') def index(): return render_template('index.html') @app.route('/articles') def articles(): return render_template('/retVals.html', articles=articles) @app.route('/article/<string:id>/') def article(id): return render_template('article.html', ) class rsp_form(Form): cle = StringField('cle', validators=[validators.Length(min=1, max=36)]) x = StringField('x', validators=[validators.Length(min=1, max=16)]) nbRonds = StringField('nbRonds',
def article(): return render_template("articles.html", articles=data.articles())
app.debug = True # Secret key: app.secret_key = SECRET_KEY # Config MySQL: app.config['MYSQL_HOST'] = MYSQL_HOST app.config['MYSQL_USER'] = MYSQL_USER app.config['MYSQL_PASSWORD'] = MYSQL_PASSWORD app.config['MYSQL_DB'] = MYSQL_DB app.config['MYSQL_CURSORCLASS'] = MYSQL_CURSORCLASS # Init MySQL mysql = MySQL(app) objects = articles() # Home page @app.route('/') def home(): return render_template("home.html") # About page @app.route('/about') def about(): return render_template("about.html") # Articles List
app = Flask(__name__) def mysql_config(): # Config MySQL app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = '******' app.config['MYSQL_PASSWORD'] = '' app.config['MYSQL_DB'] = 'flaskapp' app.config['MYSQL_CURSORCLASS'] = 'DictCursor' return MySQL(app) mysql = mysql_config() articles_var = articles() @app.route('/') def index(): return render_template('home.html') @app.route('/about') def about(): return render_template('about.html') @app.route('/articles') def articles(): cur = mysql.connection.cursor()