python - flask sqlalchemy unknown database error -
i'm trying create web application using flask , flask-sqlalchemy, have following code
flask.ext.sqlalchemy import sqlalchemy flask import flask app= flask(__name__) app.config['sqlalchemy_database_uri']= 'mysql+mysqldb://root:presario@127.0.0.1/testdb' db = sqlalchemy(app)
when run db.create_all() command line, unknown database 'testdb' error i'm working on ubuntu code above works on windows machine.
i've tried adding port number, removing python connector nothing works. below stack trace
file "/usr/lib/python2.7/dist-packages/mysqldb/__init__.py", line 81, in connect return connection(*args, **kwargs) file "/usr/lib/python2.7/dist-packages/mysqldb/connections.py", line 187, in __init__ super(connection, self).__init__(*args, **kwargs2) sqlalchemy.exc.operationalerror: (operationalerror) (1049, "unknown database 'testdb'") none none
i suggest database 'testdb' not exist.
sqlalchemy not create database you. have connect existing database. create tables.
joe
Comments
Post a Comment