提交 86b9134b 编写于 作者: X xj.lin

Merge branch 'develop' of 192.168.1.105:jinhai/vecwise_engine into develop

......@@ -8,3 +8,20 @@
- `conda install faiss-gpu cuda90 -c pytorch # For CUDA9.0`
- `conda install flask`
- `pip install flask-restful`
### Create Database
- Install MySQL
- `sudo apt-get update`
- `sudo apt-get install mariadb-server`
- Create user and database:
- `create user vecwise;`
- `create database vecdata;`
- `grant all privileges on vecdata.* to 'vecwise'@'%';`
- `flush privileges;`
- Create table:
- `python` # enter python3 interaction environment
- `from engine import db`
- `db.create_all()`
......@@ -10,6 +10,7 @@ app.config.from_object('engine.settings')
print ("Create database instance")
db = SQLAlchemy(app)
from engine.model.IndexTable import IndexTable
from engine.model.GroupTable import GroupTable
from engine.model.FileTable import FileTable
from engine.controller import IndexManage
from engine import db
class IndexTable(db.Model):
__tablename__ = 'index_table'
class FileTable(db.Model):
__tablename__ = 'file_table'
id = db.Column(db.Integer, primary_key=True)
tablename = db.Column(db.String(100))
group_name = db.Column(db.String(100))
filename = db.Column(db.String(100))
type = (db.Integer)
row_number = db.Column(db.Integer)
def __init__(self, tablename, filename, type):
self.tablename = tablename
def __init__(self, group_name, filename, type):
self.group_name = group_name
self.filename = filename
self.type = type
self.row_number = 0
def __repr__(self):
return '<IndexTable $r>' % self.tablename
\ No newline at end of file
return '<FileTable $r>' % self.tablename
\ No newline at end of file
from engine import db
class GroupTable(db.Model):
__tablename__ = 'group_table'
id = db.Column(db.Integer, primary_key=True)
group_name = db.Column(db.String(100))
file_number = db.Column(db.Integer)
def __init__(self, group_name):
self.group_name = group_name
self.file_number = 0
def __repr__(self):
return '<GroupTable $r>' % self.group_name
\ No newline at end of file
......@@ -2,5 +2,5 @@
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
# SECRET_KEY='A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://vecwise@127.0.0.1:3306/vecdata"
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册