mirror of
https://gitee.com/CloudOrc/SolidUI.git
synced 2025-12-06 11:59:07 +08:00
test example
This commit is contained in:
10
.env
10
.env
@@ -1,10 +0,0 @@
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_NAME=solidui
|
||||
DB_USER=root
|
||||
DB_PASS=SolidUI@123
|
||||
API_PORT=5010
|
||||
WEB_PORT=5110
|
||||
SNAKEMQ_PORT=8765
|
||||
SNAKEMQ_LISTENER=127.0.0.1
|
||||
SNAKEMQ_CONNECTOR=127.0.0.1
|
||||
18
.flaskenv
Normal file
18
.flaskenv
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
FLASK_APP="solidui.app:create_app()"
|
||||
FLASK_DEBUG=true
|
||||
@@ -15,7 +15,10 @@
|
||||
from flask import current_app, Flask
|
||||
from werkzeug.local import LocalProxy
|
||||
from solidui.app import create_app
|
||||
from solidui.extensions import (
|
||||
appbuilder,
|
||||
db,
|
||||
)
|
||||
|
||||
|
||||
app = create_app()
|
||||
app: Flask = current_app
|
||||
conf = LocalProxy(lambda: current_app.config)
|
||||
|
||||
@@ -21,23 +21,19 @@ import click
|
||||
from colorama import Fore, Style
|
||||
from flask.cli import FlaskGroup, with_appcontext
|
||||
from solidui import app, cli
|
||||
from solidui.app import create_app
|
||||
from solidui.cli.lib import normalize_token
|
||||
from solidui.extensions import db
|
||||
|
||||
|
||||
def create_solidui_app():
|
||||
return create_app()
|
||||
|
||||
@click.group(
|
||||
cls=FlaskGroup,
|
||||
create_app=create_solidui_app,
|
||||
context_settings={"token_normalize_func": normalize_token},
|
||||
)
|
||||
@with_appcontext
|
||||
def solidui() -> None:
|
||||
"""This is a management script for the SolidUI application."""
|
||||
|
||||
print("solidui()")
|
||||
@app.shell_context_processor
|
||||
def make_shell_context() -> dict[str, Any]:
|
||||
return {"app": app, "db": db}
|
||||
@@ -76,15 +72,3 @@ def version(verbose: bool) -> None:
|
||||
print(Style.RESET_ALL)
|
||||
|
||||
|
||||
def run_app():
|
||||
print("测试1")
|
||||
"""Run the Superset web server."""
|
||||
host = app.config.get("SOLIDUI_WEBSERVER_ADDRESS", "0.0.0.0")
|
||||
port = app.config.get("SOLIDUI_WEBSERVER_PORT", 8088)
|
||||
app.run(host=host, port=port)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_app()
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class SolidUIAppInitializer:
|
||||
def __init__(self, app: 'SolidUIApp') -> None:
|
||||
def __init__(self, app: SolidUIApp) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.solidui_app = app
|
||||
@@ -39,7 +39,7 @@ class SolidUIAppInitializer:
|
||||
|
||||
@deprecated(details="use self.solidui_app instead of self.flask_app") # type: ignore
|
||||
@property
|
||||
def flask_app(self) -> 'SolidUIApp':
|
||||
def flask_app(self) -> SolidUIApp:
|
||||
return self.solidui_app
|
||||
|
||||
|
||||
|
||||
@@ -23,17 +23,16 @@ logger = logging.getLogger(__name__)
|
||||
class Example(BaseSolidUIApi):
|
||||
|
||||
@expose(
|
||||
"/values/",
|
||||
"/values/test",
|
||||
methods=("GET",),
|
||||
)
|
||||
@protect()
|
||||
@safe
|
||||
def get_column_values(
|
||||
self, datasource_type: str, datasource_id: int, column_name: str
|
||||
self
|
||||
) -> FlaskResponse:
|
||||
try:
|
||||
print("测试get_column_values")
|
||||
except ValueError:
|
||||
return self.response(
|
||||
400, message=f"Invalid datasource type: {datasource_type}"
|
||||
400, message=f"Invalid datasource type: cesr"
|
||||
)
|
||||
Reference in New Issue
Block a user