Write books in pychar procedure is as follows:
The from flask_sqlalchemy import SQLAlchemy
The from flaskapp import app
App. Config [' SQLALCHEMY_DATABASE_URI]='mysql + pymsql://root: 111111 @127.0.0.1:3306/test'
App. Config [' SQLALCHEMY_TRACK_MODIFICATIONS]=True
The db=SQLAlchemy (app)
Class Role (db Model) :
__tablename__='roles'
Id=db. The Column (db. The Integer, primary_key=True, autoincrement=True, nullable=False)
Name=db. The Column (the String (32), unique=True, nullable=False)
If __name__=="__main__ ':
# to create a list of roles
Db. Create_all ()
But in running the error is: after sqlalchemy. Exc. NoSuchModuleError: Can 't load plugins: sqlalchemy. Dialects: mysql. Pymsql
Inquire on the net related error solution, said there was no install mysql driver, but some post said after Python2.7 need not mysql - python, the environment has been installed pymysql,
But in the mysql installation - Python times the following error:
Excuse me each loudly how to end, thank you!
CodePudding user response:
Brothers solved yet? Can you say the answer