提交 3818ea20 编写于 作者: J jinhai

Merge branch 'jinhai' into 'develop'

Add model

See merge request jinhai/vecwise_engine!1
# -*- coding: utf-8 -*-
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
print ("Load paramters")
app = Flask(__name__)
app.config.from_object('engine.settings')
#创建数据库对象
print ("Create database instance")
db = SQLAlchemy(app)
from engine.model.IndexTable import IndexTable
from engine.controller import IndexManage
from flask import Flask
from flask_restful import Resource, Api
from engine import app, db
app = Flask(__name__)
# app = Flask(__name__)
api = Api(app)
......@@ -64,5 +65,5 @@ api.add_resource(Index, '/vector/index')
api.add_resource(VectorSearch, '/vector/search')
if __name__ == '__main__':
app.run(debug=True)
# if __name__ == '__main__':
# app.run()
from engine import db
class IndexTable(db.Model):
__tablename__ = 'index_table'
id = db.Column(db.Integer, primary_key=True)
tablename = db.Column(db.String(100))
filename = db.Column(db.String(100))
type = (db.Integer)
def __init__(self, tablename, filename, type):
self.tablename = tablename
self.filename = filename
self.type = type
def __repr__(self):
return '<IndexTable $r>' % self.tablename
\ No newline at end of file
# _*_ coding: utf-8 _*_
DEBUG = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY='A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
SQLALCHEMY_DATABASE_URI = "mysql://user:passwd@ip:port/BLOG_DB"
\ No newline at end of file
from engine import app
app.run()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册