sanbo1200 commited on
Commit
766e5f9
·
verified ·
1 Parent(s): f8df211

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -1
app.py CHANGED
@@ -1,9 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from flask import Flask, redirect, abort, request
 
2
 
3
  app = Flask(__name__)
4
 
5
  @app.route('/')
6
  def index():
 
 
 
 
 
 
 
 
 
 
7
  return redirect('https://chat3.eqing.tech', code=302)
8
 
9
  @app.route('/<path:path>', methods=['GET', 'POST'])
@@ -15,4 +45,4 @@ def redirect_all(path):
15
  return redirect('https://chat3.eqing.tech', code=302)
16
 
17
  if __name__ == '__main__':
18
- app.run()
 
1
+ # from flask import Flask, redirect, abort, request
2
+
3
+ # app = Flask(__name__)
4
+
5
+ # @app.route('/')
6
+ # def index():
7
+ # return redirect('https://chat3.eqing.tech', code=302)
8
+
9
+ # @app.route('/<path:path>', methods=['GET', 'POST'])
10
+ # def redirect_all(path):
11
+ # if 'create' in path or 'fd' in path or 'web' in path:
12
+ # return redirect('http://127.0.0.1', code=301)
13
+ # if request.method == 'POST':
14
+ # return redirect('http://127.0.0.1', code=301)
15
+ # return redirect('https://chat3.eqing.tech', code=302)
16
+
17
+ # if __name__ == '__main__':
18
+ # app.run()
19
+
20
  from flask import Flask, redirect, abort, request
21
+ import requests
22
 
23
  app = Flask(__name__)
24
 
25
  @app.route('/')
26
  def index():
27
+ # 添加调试信息
28
+ try:
29
+ # 先检查目标URL是否可访问
30
+ response = requests.head('https://chat3.eqing.tech', timeout=5)
31
+ print(f"Target server status: {response.status_code}")
32
+ except Exception as e:
33
+ print(f"Target server error: {e}")
34
+ # 如果目标服务器不可达,可以返回错误页面或备用地址
35
+ return f"目标服务器暂时不可用: {e}", 503
36
+
37
  return redirect('https://chat3.eqing.tech', code=302)
38
 
39
  @app.route('/<path:path>', methods=['GET', 'POST'])
 
45
  return redirect('https://chat3.eqing.tech', code=302)
46
 
47
  if __name__ == '__main__':
48
+ app.run(debug=True) # 开启调试模式查看详细信息