from flask import render_template,request
from app import app
from .form import Book
import os
import _thread

@app.route('/')

@app.route('/index')
def index():
    return render_template('login.html',form=Book())

@app.route('/confirmed', methods=['get', 'post'])
def BookTest():
    form = Book()
    if request.method == 'POST':
        if form.validate_on_submit():
            username = form.username.data
            password = form.password.data
            email = form.email.data
            area = form.area.data
            cmd='python3 auto.py '+username+' '+password+' '+email+' '+area
            _thread.start_new_thread(os.system,(cmd,))
            return render_template('success.html')