main_sys_restart.py 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. from .tool.func import *
  2. def main_sys_restart():
  3. with get_db_connect() as conn:
  4. if admin_check() != 1:
  5. return re_error('/error/3')
  6. if flask.request.method == 'POST':
  7. admin_check(None, 'restart')
  8. print('----')
  9. print('Restart')
  10. run_list = [sys.executable, 'python' + python_ver, 'python3', 'python']
  11. for exe_name in run_list:
  12. try:
  13. os.execl(exe_name, os.path.abspath(__file__), *sys.argv)
  14. except:
  15. pass
  16. return re_error('/error/33')
  17. else:
  18. return easy_minify(flask.render_template(skin_check(),
  19. imp = [load_lang('wiki_restart'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
  20. data = '''
  21. <form method="post">
  22. <button type="submit">''' + load_lang('restart') + '''</button>
  23. </form>
  24. ''',
  25. menu = [['manager', load_lang('return')]]
  26. ))