main_func_error_404.py 561 B

1234567891011121314
  1. from .tool.func import *
  2. def main_func_error_404(e = ''):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if os.path.exists('404.html') and flask.request.path != '/':
  6. return open('404.html', encoding = 'utf8').read(), 404
  7. else:
  8. curs.execute(db_change('select data from other where name = "frontpage"'))
  9. db_data = curs.fetchall()
  10. db_data = db_data[0][0] if db_data and db_data[0][0] != '' else 'FrontPage'
  11. return redirect('/w/' + url_pas(db_data))