What error are you seeing when you run this?

On Mon, Aug 10, 2020 at 8:08 AM Tech Buddy <[email protected]>
wrote:

> from flask import Flask,render_template,request
> from flask_sqlalchemy import SQLAlchemy
>
> app=Flask(__name__)
> app.config['SQLALCHEMY DATAVASE URI']='mysql://root:@localhost/mk_gupta'
> db = SQLAlchemy(app)
>
>
> class Contacts(db.Model):
> Serial_no = db.Column(db.Integer, primary_key=True)
> Name=db.Column(db.String(40),unique=False,nullable=False)
> Email=db.Column(db.String(40),unique=False,nullable=False)
> Subject=db.Column(db.String(100),unique=False,nullable=True)
> Message=db.Column(db.String(500),unique=False,nullable=False)
>
>
>
> @app.route("/",methods=['GET','POST'])
> def home():
> if (request.method == 'POST'):
> '''Add entry to the database'''
> name=request.form.get('name')
> email=request.form.get('email')
> subject=request.form.get('subject')
> message=request.form.get('message')
>
> entry=Contacts(Name=name,Email=email,Subject=subject,Message=message)
> db.create_all()
> db.session.add(entry)
> db.session.commit()
> db.session.close()
> return render_template('index.html')
>
>
>
>
> if __name__ =='__main__':
> app.run(debug=True)
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sqlalchemy/fc20db78-f150-488a-9ce1-86eee5c7e89an%40googlegroups.com
> <https://groups.google.com/d/msgid/sqlalchemy/fc20db78-f150-488a-9ce1-86eee5c7e89an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAPbEHsdXF049D6Je8Vuzcey5y9UiVe90DiWPc%2B8NbEeikeb90Q%40mail.gmail.com.

Reply via email to