Merge pull request #19 from Shane-XB-Qian/master

to make manager.py error desc clear
1.x
vapao 2020-01-16 19:00:57 +08:00 committed by GitHub
commit 67c137da9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View File

@ -78,10 +78,10 @@ $ -e MYSQL_HOST = "192.168.1.10" // 指定数据库地址
  2. Start server 启动服务端:   2. Start server 启动服务端:
$ cd spug/spug_api $ cd spug/spug_api
$ pip install -r requirements.txt //安装依赖包 $ pip install -r requirements.txt //安装依赖包
$ mv config.py.example config.py //编辑配置文件 $ cp config.py.example config.py //编辑配置文件
$ python manage.py init_db //初始化数据库 $ python3 manage.py init_db //初始化数据库
$ python manage.py create_admin //创建管理员 $ python3 manage.py create_admin //创建管理员
  $ python main.py //启动服务   $ python3 main.py //启动服务
3. Start web 启动前端: 3. Start web 启动前端:
$ cd spug/spug_web $ cd spug/spug_web

View File

@ -1,6 +1,7 @@
# coding=utf-8 # coding=utf-8
from functools import wraps from functools import wraps
from getpass import getpass from getpass import getpass
from config import DEBUG
import sys import sys
import os import os
@ -110,10 +111,16 @@ if __name__ == '__main__':
if len(sys.argv) == 1: if len(sys.argv) == 1:
print_usage() print_usage()
sys.exit(1) sys.exit(1)
cmd = sys.argv.pop(0) r_func = commands.get(sys.argv[1])
arg1 = sys.argv.pop(0)
r_func = commands.get(arg1)
if callable(r_func): if callable(r_func):
r_func(*sys.argv) try:
r_func(*sys.argv[2:])
except BaseException:
if DEBUG:
print(sys.exc_info())
else:
print_usage()
print('遇到了不可能会出现的错误(请检查输入命令是否正确)')
else: else:
print('遇到了不可能会出现的错误!') print_usage()
print('遇到了不可能会出现的错误(请检查输入命令是否正确)')