Profile

User profile and story timeline

user-img
nyg

mac升级后,发现执行python hello.py shell提示No module named 'flask'?检查下来发现所有的虚拟环境virtualenv都未安装,是系统升级还是删掉了一些文件?但是网站运行正常?

回复

  • ·
    接入数据库:1、在view.py中增加函数路由def association( ),引入association;2、在templates模版文件夹中增加associa-datatables.html文件;3、models.py文件中添加class Association(db.Model);4、要让FlaskSQLAlchemy根据模型类创建数据库。方法是使用db.create_all( )函数 p. 50
  • ·
    (venv)$python hello.py shell >>> from hello import db >>> db.create_all( )