Commit 79ef151f authored by SimonGlomb's avatar SimonGlomb
Browse files

form reads parameters

parent f251d850
from flask import Flask, render_template
from flask import Flask, render_template, request
import os
import model
app = Flask(__name__)
@app.route("/")
def hello_world():
return render_template('start_page.html')
form = model.MyForm()
return render_template('start_page.html', form=form)
@app.route("/run_code")
@app.route("/run_code", methods=["POST"])
def run_code():
os.system("python ./code/main.py")
data = request.form
print(data)
#os.system("python ./code/main.py")
return "<p>Back to Main Page</p>"
@app.route("/set_params", methods=["POST"])
def set_params():
ocel_file = request.form.get("ocel_file")
form = model.MyForm()
print(form.name.data)
if form.validate_on_submit():
return "<p>Parameters where set successfully.</p>"
return render_template('start_page.html', form=form)
@app.route("/oc-dfg/<int:dfg_num>")
def get_oc_dfg():
return
if __name__ == "__main__":
SECRET_KEY = os.urandom(32)
app.config['SECRET_KEY'] = SECRET_KEY
app.run()
\ No newline at end of file
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired
class MyForm(FlaskForm):
ocel_file = StringField('ocel_file', validators=[DataRequired()])
mode = StringField('mode', validators=[DataRequired()])
object_type = StringField('object_type', validators=[DataRequired()])
attr_weights = StringField('attr_weights', validators=[DataRequired()])
clustering_mode = StringField('clustering_mode')
cluster_count = StringField('cluster_count')
ocel_file_type = StringField('ocel_file_type')
graph_file_type = StringField('graph_file_type')
<p>Hello, World!</p>
<form action="{{ url_for('set_params') }}" method="post" name=params enctype="multipart/form-data">
<input type="text" name=ocel_file id="ocel_file" size="40" placeholder="Set ocel File">
<input type="text" name=mode id="mode" size="40" placeholder="Set mode">
<input type="text" name=object_type id="object_type" size="40" placeholder="Set object_type">
<input type="text" name=attr_weights id="attr_weights" size="40" placeholder="Set attr_weights">
<input type="text" name=clustering_mode id="clustering_mode" size="40" placeholder="Set clustering_mode">
<input type="text" name=cluster_count id="cluster_count" size="40" placeholder="Set cluster_count">
<input type="text" name=ocel_file_type id="ocel_file_type" size="40" placeholder="Set ocel_file_type">
<input type="text" name=graph_file_type id="graph_file_type" size="40" placeholder="Set graph_file_type">
<button name="set_params" value="Set">Set</button>
</form>
<form method="POST" action="{{ url_for('set_params') }}">
{{ form.csrf_token }}
{{ form.name.label }} {{ form.name(size=20) }}
<input type="submit" value="Set">
</form>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment