main_error_404.py 433 B

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