add flask-migrate
This commit is contained in:
parent
6b3c83cebb
commit
d9dd9de94d
|
@ -6,3 +6,4 @@ __temp
|
|||
.DS_Store
|
||||
docklet.conf
|
||||
home.html
|
||||
src/migrations/
|
||||
|
|
|
@ -16,7 +16,7 @@ fi
|
|||
# some packages' name maybe different in debian
|
||||
apt-get install -y cgmanager lxc lxcfs lxc-templates lvm2 bridge-utils curl exim4 openssh-server openvswitch-switch
|
||||
apt-get install -y python3 python3-netifaces python3-flask python3-flask-sqlalchemy python3-pampy python3-httplib2
|
||||
apt-get install -y python3-psutil
|
||||
apt-get install -y python3-psutil python3-flask-migrate
|
||||
apt-get install -y python3-lxc
|
||||
apt-get install -y python3-requests python3-suds
|
||||
apt-get install -y nodejs nodejs-legacy npm
|
||||
|
@ -60,7 +60,7 @@ if [ ! -d /opt/docklet/local/basefs ]; then
|
|||
echo "Generating basefs"
|
||||
wget -P /opt/docklet/local http://iwork.pku.edu.cn:1616/basefs-0.11.tar.bz2 && tar xvf /opt/docklet/local/basefs-0.11.tar.bz2 -C /opt/docklet/local/ > /dev/null
|
||||
[ $? != "0" ] && echo "Generate basefs failed, please download it from http://unias.github.io/docklet/download to FS_PREFIX/local and then extract it using root. (defalut FS_PRERIX is /opt/docklet)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Some packagefs can be downloaded from http://unias.github.io/docklet.download"
|
||||
echo "you can download the packagefs and extract it to FS_PREFIX/local using root. (default FS_PREFIX is /opt/docklet"
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
from flask_migrate import Migrate,MigrateCommand
|
||||
from model import *
|
||||
from flask_script import Manager
|
||||
from flask import Flask
|
||||
|
||||
migrate = Migrate(app,db)
|
||||
manager = Manager(app)
|
||||
manager.add_command('db',MigrateCommand)
|
||||
|
||||
if __name__ == '__main__':
|
||||
manager.run()
|
|
@ -45,6 +45,7 @@ app.config['SQLALCHEMY_BINDS'] = {
|
|||
'beansapplication': 'sqlite:///'+fsdir+'/global/sys/BeansApplication.db',
|
||||
'system': 'sqlite:///'+fsdir+'/global/sys/System.db'
|
||||
}
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
||||
try:
|
||||
secret_key_file = open(env.getenv('FS_PREFIX') + '/local/token_secret_key.txt')
|
||||
app.secret_key = secret_key_file.read()
|
||||
|
@ -346,3 +347,11 @@ class VCluster(db.Model):
|
|||
|
||||
def __repr__(self):
|
||||
return "{\"clusterid\":\"%d\", \"clustername\":\"%s\", \"ownername\": \"%s\", \"status\":\"%s\", \"size\":\"%d\", \"proxy_server_ip\":\"%s\", \"create_time\":\"%s\"}" % (self.clusterid, self.clustername, self.ownername, self.status, self.size, self.proxy_server_ip, self.create_time.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
class Image(db.Model):
|
||||
__bind_key__ = 'system'
|
||||
imagename = db.Column(db.String(50))
|
||||
id = db.Column(db.BigInteger, primary_key=True)
|
||||
isshared = db.Column(db.Boolean)
|
||||
ownername = db.Column(db.String(20))
|
||||
description = db.Column(db.Text)
|
||||
|
|
Loading…
Reference in New Issue