代码拉取完成,页面将自动刷新
同步操作将从 digwtx/wtxlog 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# -*- coding: utf-8 -*-
import os
import sys
from os import path
deps_paths = [
path.join(path.split(path.realpath(__file__))[0], 'deps'),
path.join(path.split(path.realpath(__file__))[0], 'mydeps'),
]
for deps_path in deps_paths:
if deps_path not in sys.path:
sys.path.insert(0, deps_path)
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='wtxlog/*')
COV.start()
from wtxlog import create_app, db, get_appconfig
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
# bae, sae, production, local(default)
app = create_app(os.getenv('APP_CONFIG') or str(get_appconfig()) or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
@manager.command
def deploy():
"""Run deployment tasks."""
from flask.ext.migrate import upgrade
from wtxlog.models import Role
upgrade()
# db.create_all()
# create user roles
Role.insert_roles()
@manager.shell
def make_shell_context():
from wtxlog.models import User, Role, Permission, Category, Tag, \
Article, Topic, Link, FriendLink, Flatpage, Label, Redirect, Setting
return dict(
app=app, db=db, User=User, Role=Role, Permission=Permission,
Category=Category, Tag=Tag, Article=Article, Topic=Topic,
Link=Link, FriendLink=FriendLink, Flatpage=Flatpage,
Label=Label, Redirect=Redirect, Setting=Setting
)
@manager.command
def test(coverage=False):
"""Run the unit tests."""
if coverage and not os.environ.get('FLASK_COVERAGE'):
import sys
os.environ['FLASK_COVERAGE'] = '1'
os.execvp(sys.executable, [sys.executable] + sys.argv)
import unittest
tests = unittest.TestLoader().discover('tests')
unittest.TextTestRunner(verbosity=2).run(tests)
if COV:
COV.stop()
COV.save()
print('Coverage Summary:')
COV.report()
basedir = os.path.abspath(os.path.dirname(__file__))
covdir = os.path.join(basedir, 'tmp', 'coverage')
COV.html_report(directory=covdir)
print('HTML version: file://%s/index.html' % covdir)
COV.erase()
if __name__ == '__main__':
manager.run()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。