-
Notifications
You must be signed in to change notification settings - Fork 3
/
application.py
32 lines (25 loc) · 873 Bytes
/
application.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask, render_template, flash, request, send_file, send_from_directory
from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField
from driver import MainDriver
from docx import Document
from io import StringIO
import os
# App config.
DEBUG = True
app = Flask(__name__)
app.config.from_object(__name__)
app.config['SECRET_KEY'] = '7d441f27d441f27567d441f2b6176a'
class ReusableForm(Form):
name = TextField('Name:', validators=[validators.required()])
@app.route("/main/<topics>", methods=['GET', 'POST'])
def hello(topics):
form = ReusableForm(request.form)
cur_class = MainDriver()
res = cur_class.article_maker(topics)
# print(res)
return send_from_directory(directory = os.getcwd(), filename=res)
@app.route("/")
def world():
return "Hello WOrld"
if __name__ == "__main__":
app.run()