-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (19 loc) · 756 Bytes
/
main.py
File metadata and controls
26 lines (19 loc) · 756 Bytes
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
from flask import Flask,render_template,request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:@localhost/deva'
db = SQLAlchemy(app)
class Devathon(db.Model):
sno = db.Column(db.Integer, primary_key=True)
mail = db.Column(db.String(20), nullable=False)
password = db.Column(db.String(20), nullable=False)
@app.route("/", methods = ['GET', 'POST'])
def home():
if(request.method=='POST'):
email = request.form.get('email')
pw = request.form.get('pw')
entry = Devathon(password = pw, mail = email )
db.session.add(entry)
db.session.commit()
return render_template('deva.html')
app.run(debug=True)