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__)
def hello_world():
return render_template('start_page.html')
form = model.MyForm()
return render_template('start_page.html', form=form)
@app.route("/run_code", methods=["POST"])
def run_code():
os.system("python ./code/")
data = request.form
#os.system("python ./code/")
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()
if form.validate_on_submit():
return "<p>Parameters where set successfully.</p>"
return render_template('start_page.html', form=form)
def get_oc_dfg():
if __name__ == "__main__":
SECRET_KEY = os.urandom(32)
app.config['SECRET_KEY'] = SECRET_KEY
\ 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 method="POST" action="{{ url_for('set_params') }}">
{{ form.csrf_token }}
{{ }} {{ }}
<input type="submit" value="Set">
\ 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