mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-16 05:07:55 +08:00
* refactor cli to improve ux and enable easy incorporation of prepare as a subcommand * switches to use click, which removes some boilerplate and gets us some improved ux for free * changes the entry point for the cli * changes the name of the browser option to --open and makes the default false
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
import os
|
|
|
|
from flask import Flask
|
|
from flask_caching import Cache
|
|
from flask_compress import Compress
|
|
from flask_cors import CORS
|
|
from flask_restful_swagger_2 import get_swagger_blueprint
|
|
|
|
from .rest_api.rest import get_api_resources
|
|
from .util.utils import Float32JSONEncoder
|
|
from .web import webapp
|
|
|
|
REACTIVE_LIMIT = 1_000_000
|
|
|
|
app = Flask(__name__, static_folder="web/static")
|
|
app.json_encoder = Float32JSONEncoder
|
|
cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000})
|
|
Compress(app)
|
|
CORS(app)
|
|
|
|
# Config
|
|
SECRET_KEY = os.environ.get("CXG_SECRET_KEY", default="SparkleAndShine")
|
|
|
|
app.config.update(
|
|
SECRET_KEY=SECRET_KEY,
|
|
)
|
|
|
|
# Application Data
|
|
data = None
|
|
|
|
# A list of swagger document objects
|
|
docs = []
|
|
resources = get_api_resources()
|
|
docs.append(resources.get_swagger_doc())
|
|
|
|
app.register_blueprint(webapp.bp)
|
|
app.register_blueprint(resources.blueprint)
|
|
app.register_blueprint(
|
|
get_swagger_blueprint(docs, "/api/swagger", produces=["application/json"], title="cellxgene rest api",
|
|
description="An API connecting ExpressionMatrix2 clustering algorithm to cellxgene"))
|
|
|
|
app.add_url_rule("/", endpoint="index")
|