flask sql cann't insert Variable in VALUES

Frank Liou fk26541598fk at gmail.com
Fri Jul 4 06:15:57 EDT 2014


I try to insert username in to my table

it show

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

it maybe mean no request

i try to change username to '123123'

then it works....

what's problem with this?



@app.route('/user/<username>',methods=['GET','POST'])
def hello(username):
        if request.method=='POST':
            save_friends(username)
            return username


def save_friends(username):
    conn = engine.connect()
    conn.execute("INSERT INTO friends(name) VALUES(username)")



More information about the Python-list mailing list