mirror of https://github.com/milvus-io/milvus.git
Merge branch 'develop' into linxj
commit
aab9f9f287
|
@ -1 +1,5 @@
|
|||
.idea/
|
||||
.ycm_extra_conf.py
|
||||
__pycache__
|
||||
|
||||
.env
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
### Geting started
|
||||
|
||||
- Create .env base on .env.example
|
||||
|
||||
- Install Miniconda first
|
||||
- `conda create --name vec_engine python=3.6`
|
||||
- `conda activate vec_engine`
|
||||
- `conda install faiss-gpu cuda90 -c pytorch # For CUDA9.0`
|
||||
- `conda install flask`
|
||||
- `pip install flask-restful flask_sqlalchemy`
|
||||
- `pip install flask-restful flask_sqlalchemy flask_script`
|
||||
- `pip install pymysql environs`
|
||||
|
||||
### Create Database
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
DEBUG=True
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS=False
|
||||
SECRET_KEY=test
|
||||
SQLALCHEMY_DATABASE_URI=mysql+pymysql://vecwise@127.0.0.1:3306/vecdata
|
||||
|
||||
ROW_LIMIT=10000000
|
||||
DATABASE_DIRECTORY=/tmp
|
|
@ -1,10 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from engine import settings
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
print ("Load paramters")
|
||||
app = Flask(__name__)
|
||||
app.config.from_object('engine.settings')
|
||||
app.config.from_object(settings)
|
||||
|
||||
#创建数据库对象
|
||||
print ("Create database instance")
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
# _*_ coding: utf-8 _*_
|
||||
from environs import Env
|
||||
|
||||
DEBUG = True
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
# SECRET_KEY='A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://vecwise@127.0.0.1:3306/vecdata"
|
||||
env = Env()
|
||||
env.read_env()
|
||||
|
||||
ROW_LIMIT = 1000000
|
||||
DATABASE_DIRECTORY = '/tmp'
|
||||
DEBUG = env.bool('DEBUG', default=False)
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = env.bool('DEBUG', default=False)
|
||||
SECRET_KEY = env.str('SECRET_KEY', 'test')
|
||||
SQLALCHEMY_DATABASE_URI = env.str('SQLALCHEMY_DATABASE_URI')
|
||||
|
||||
ROW_LIMIT = env.int('ROW_LIMIT')
|
||||
DATABASE_DIRECTORY = env.str('DATABASE_DIRECTORY')
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
from flask_script import Manager
|
||||
|
||||
from engine import db, app
|
||||
|
||||
manager = Manager(app)
|
||||
|
||||
@manager.command
|
||||
def create_all():
|
||||
db.create_all()
|
||||
|
||||
@manager.command
|
||||
def drop_all():
|
||||
db.drop_all()
|
||||
|
||||
@manager.command
|
||||
def recreate_all():
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
|
||||
if __name__ == '__main__':
|
||||
manager.run()
|
Loading…
Reference in New Issue