Flask-SQLAlchemy应用程序未发布到数据库

时间:2018-06-16 16:38:23

标签: python flask flask-sqlalchemy

我在python项目上处理废弃数据,但最后没有在数据库上写入任何内容 我认为问题出在Flask-SQLAlchemy上 但我不知道如何解决问题

2



beautifulsoup4==4.5.1
Flask-Migrate==2.0.3
Flask-Script==2.0.5
Flask-SQLAlchemy==2.1
requests==2.10.0
selenium==3.0.2




代码是:

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'

db = SQLAlchemy(app)
migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command('db', MigrateCommand)


class GooglePlay(db.Model):
    __tablename__ = 'GooglePlay'

    Id = db.Column(db.Integer, primary_key=True)
    App = db.Column(db.String(128))
    Link = db.Column(db.String(128))
    Autor= db.Column(db.String(64))
    Rate = db.Column(db.Integer)
    Download = db.Column(db.String(64))
    Publish= db.Column(db.DateTime)
    Item = db.Column(db.String(32))


if __name__ == '__main__':
    manager.run()

0 个答案:

没有答案