-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.py
43 lines (21 loc) · 781 Bytes
/
home.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
33
34
35
36
37
38
39
40
41
42
from flask import Flask,render_template,request,redirect,url_for
import os
from flask_sqlalchemy import SQLAlchemy
# from flask_migrate import Migrate
app = Flask(__name__)
basedir = os.path.abspath(os.path.dirname(__file__))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'data.sqlite12')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db=SQLAlchemy(app)
class filecontents(db.Model):
id = db.Column(db.Integer,primary_key=True)
name = db.Column(db.String(100),nullable=False)
@app.route('/')
def index():
return render_template('home.html')
@app.route('/upload',methods=['POST'])
def upload():
file = request.files['inputfiles']
return file.filename
if __name__ == '__main__':
app.run(debug=True)