init
[GitLab/stricted-build/lineage_builder.git] / ui / app.py
1 import os
2
3 import requests
4 from flask import Flask, render_template, request, abort
5 from flask_caching import Cache
6 from flask_migrate import Migrate
7 from flask_sqlalchemy import SQLAlchemy
8
9 from ui import gitlab, config, models
10
11 app = Flask(__name__)
12 app.config.from_object(config)
13 cache = Cache(app)
14 models.db.init_app(app)
15 migrate = Migrate(app, models.db)
16
17
18 headers = {'Private-Token': os.environ.get('GITLAB_TOKEN', '')}
19
20 @app.route('/')
21 def main():
22 return render_template('index.html')
23
24 @app.route("/webhook", methods=('POST',))
25 def process_webhook():
26 gitlab.webhooks.process(request)
27 return "OK", 200
28
29 if __name__ == '__main__':
30 app.run(host='0.0.0.0', port=5000)