-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (23 loc) · 785 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (23 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Git AI 代码统计 - 独立 Web 应用
统计 GitLab 仓库中 AI 生成代码的占比(基于 refs/notes/ai)。
"""
from flask import Flask, send_from_directory
import os
try:
from dotenv import load_dotenv
load_dotenv()
except ImportError:
pass
from git_ai_stats import git_ai_stats_bp
app = Flask(__name__, static_folder='static', template_folder='templates')
app.register_blueprint(git_ai_stats_bp)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@app.route('/')
def index():
return send_from_directory(BASE_DIR, 'index.html')
if __name__ == '__main__':
port = int(os.getenv('PORT', 8888))
host = os.getenv('HOST', '0.0.0.0')
print(f'Git AI 代码统计工具: http://{host}:{port}')
app.run(debug=True, port=port, host=host)