mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-26 17:49:15 +01:00
updated Dockerfile
This commit is contained in:
29
app.py
29
app.py
@@ -1,8 +1,13 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
|
||||
from celery import Celery
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
from flask_restful import Api, Resource
|
||||
|
||||
from config import BROKER_URL
|
||||
from routes.deploys import DeployApi
|
||||
from routes.files import FileApi
|
||||
from routes.nodes import NodeApi
|
||||
@@ -12,7 +17,7 @@ from routes.tasks import TaskApi
|
||||
|
||||
# flask app instance
|
||||
app = Flask(__name__)
|
||||
app.config.from_object('config.flask')
|
||||
app.config.from_object('config')
|
||||
# init flask api instance
|
||||
api = Api(app)
|
||||
|
||||
@@ -45,6 +50,24 @@ api.add_resource(StatsApi,
|
||||
'/api/stats',
|
||||
'/api/stats/<string:action>')
|
||||
|
||||
# start flask app
|
||||
if __name__ == '__main__':
|
||||
|
||||
def run_app():
|
||||
app.run()
|
||||
|
||||
|
||||
def run_flower():
|
||||
p = subprocess.Popen(['celery', 'flower', '-b', BROKER_URL], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
for line in iter(p.stdout.readline, 'b'):
|
||||
print(line.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# start flower app
|
||||
th_flower = threading.Thread(target=run_flower)
|
||||
th_flower.start()
|
||||
|
||||
# start flask app
|
||||
# th_app = threading.Thread(target=run_app)
|
||||
# th_app.start()
|
||||
app.run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user