removed some unnecessary files
This commit is contained in:
parent
f393e03a8e
commit
f6c43f03fc
@ -1,45 +0,0 @@
|
|||||||
from flask import Flask, url_for, render_template, Markup, redirect, request, flash
|
|
||||||
from flask import session as login_session
|
|
||||||
from flask_wtf import FlaskForm
|
|
||||||
from wtforms.validators import DataRequired
|
|
||||||
from wtforms import Form, TextField, TextAreaField, BooleanField, validators, StringField, SubmitField
|
|
||||||
from forms import ReusableForm
|
|
||||||
from config import Config
|
|
||||||
import json
|
|
||||||
|
|
||||||
app = Flask(__name__, static_url_path='', static_folder="static", template_folder="templates")
|
|
||||||
app.config.from_object(Config)
|
|
||||||
|
|
||||||
@app.route("/")
|
|
||||||
def home():
|
|
||||||
return render_template('home.html')
|
|
||||||
|
|
||||||
@app.route('/about/')
|
|
||||||
def about():
|
|
||||||
return render_template('about.html')
|
|
||||||
|
|
||||||
@app.route('/description', methods=['GET', 'POST'])
|
|
||||||
def description():
|
|
||||||
form = ReusableForm(request.form)
|
|
||||||
print (form.errors)
|
|
||||||
if request.method == 'POST' and form.validate():
|
|
||||||
return 'Success!'
|
|
||||||
return render_template('description.html', form=form)
|
|
||||||
|
|
||||||
|
|
||||||
dict={}
|
|
||||||
|
|
||||||
@app.route('/get-data', methods=['GET', 'POST'])
|
|
||||||
def savepost():
|
|
||||||
if request.method=='POST':
|
|
||||||
dict={'name':request.form['name'],'email':request.form['email'],'friend':request.form['friend'],'content':request.form['content']}
|
|
||||||
# open with "a" if the file should concatenate content
|
|
||||||
with open("data_file.json", "w") as write_file:
|
|
||||||
json.dump(dict, write_file)
|
|
||||||
return "The JSON file is ready."
|
|
||||||
else:
|
|
||||||
return "Error"
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(debug=True)
|
|
34
startform.py
34
startform.py
@ -1,34 +0,0 @@
|
|||||||
from wtforms import Form, TextField, BooleanField, StringField, SubmitField, validators
|
|
||||||
from flask import Flask, url_for, render_template, Markup, redirect, request, flash
|
|
||||||
from flask import session as login_session
|
|
||||||
from forms import ReusableForm
|
|
||||||
from config import Config
|
|
||||||
# import json_actions
|
|
||||||
import json
|
|
||||||
|
|
||||||
app = Flask(__name__, static_url_path='', static_folder="static", template_folder="templates")
|
|
||||||
app.config.from_object(Config)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
|
||||||
def description():
|
|
||||||
form = ReusableForm(request.form)
|
|
||||||
print (form.errors)
|
|
||||||
if request.method == 'POST' and form.validate():
|
|
||||||
return 'Success!'
|
|
||||||
return render_template('description-prev.html', form=form)
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(debug = True)
|
|
||||||
|
|
||||||
dict={}
|
|
||||||
|
|
||||||
@app.route('/get-data', methods=['GET', 'POST'])
|
|
||||||
def savepost():
|
|
||||||
if request.method=='POST':
|
|
||||||
dict={'name':request.form['name'],'email':request.form['email'],'friend':request.form['friend'],'content':request.form['content']}
|
|
||||||
# open with "a" if the file should concatenate content
|
|
||||||
with open("data_file.json", "w") as write_file:
|
|
||||||
json.dump(dict, write_file)
|
|
||||||
return "The JSON file is ready."
|
|
||||||
else:
|
|
||||||
return "Error"
|
|
Loading…
Reference in New Issue
Block a user