1e commit

This commit is contained in:
2023-05-22 18:05:44 +02:00
commit 8dd72266c1
1847 changed files with 340310 additions and 0 deletions

37
app.py Normal file
View File

@ -0,0 +1,37 @@
from flask import Flask, render_template, request, jsonify
import yaml
def read_yaml_file(file_path):
with open(file_path, 'r') as file:
try:
yaml_data = yaml.safe_load(file)
return yaml_data
except yaml.YAMLError as e:
print(f"Error reading YAML file: {e}")
# Provide the path to your YAML file
config_file_path = 'configuration.yaml'
# Read the YAML file
config_content = read_yaml_file(config_file_path)
# Print the YAML content
# print(config_content)
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
form_data = request.get_json()
generate_yaml(form_data)
return 'YAML file generated successfully!'
return render_template('form_template.html', config_content=config_content)
def generate_yaml(data):
with open('data.yaml', 'w') as file:
yaml.dump(data, file)
if __name__ == '__main__':
app.run(debug=True)