mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-30 18:13:23 +08:00
Move installed client check to webapp.base
Also fix favicon handling
This commit is contained in:
@@ -63,6 +63,12 @@ from galaxy.web.framework import (
|
||||
)
|
||||
from galaxy.web.framework.middleware.static import CacheableStaticURLParser as Static
|
||||
|
||||
try:
|
||||
import galaxy.client
|
||||
default_static_dir = os.path.dirname(galaxy.client.__file__)
|
||||
except ImportError:
|
||||
default_static_dir = "static/"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1153,7 +1159,7 @@ def build_url_map(app, global_conf, **local_conf):
|
||||
return Static(config_val, cache_time, directory_per_host=per_host_config)
|
||||
|
||||
# Define static mappings from config
|
||||
static_dir = get_static_from_config("static_dir", "static/")
|
||||
static_dir = get_static_from_config("static_dir", default_static_dir)
|
||||
static_dir_bare = static_dir.directory.rstrip("/")
|
||||
urlmap["/static"] = static_dir
|
||||
urlmap["/images"] = get_static_from_config("static_images_dir", f"{static_dir_bare}/images")
|
||||
@@ -1162,8 +1168,8 @@ def build_url_map(app, global_conf, **local_conf):
|
||||
urlmap["/static/welcome.html"] = get_static_from_config(
|
||||
"static_welcome_html", f"{static_dir_bare}/welcome.html", sample=default_url_path("static/welcome.sample.html")
|
||||
)
|
||||
urlmap["/favicon.ico"] = get_static_from_config(
|
||||
"static_favicon_dir", f"{static_dir_bare}/favicon.ico", sample=default_url_path("static/favicon.ico")
|
||||
urlmap["/static/favicon.svg"] = get_static_from_config(
|
||||
"static_favicon_dir", f"{static_dir_bare}/favicon.svg", sample=default_url_path("static/favicon.svg")
|
||||
)
|
||||
urlmap["/robots.txt"] = get_static_from_config(
|
||||
"static_robots_txt", f"{static_dir_bare}/robots.txt", sample=default_url_path("static/robots.txt")
|
||||
|
||||
@@ -3,12 +3,6 @@ from argparse import ArgumentParser
|
||||
|
||||
import uvicorn
|
||||
|
||||
try:
|
||||
import galaxy.client
|
||||
default_client_path = os.path.dirname(galaxy.client.__file__)
|
||||
except ImportError:
|
||||
default_client_path = "node_modules/@galaxyproject/galaxy-client"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = ArgumentParser(
|
||||
@@ -18,14 +12,15 @@ def main() -> None:
|
||||
parser.add_argument("--config", "-c", help="Galaxy config file")
|
||||
parser.add_argument("--single-user", "-s", help="Single user mode as user SINGLE_USER")
|
||||
parser.add_argument("--bind", "-b", default="localhost:8080", help="Bind to <host>:<port>")
|
||||
parser.add_argument("--client-path", "-n", default=default_client_path, help="Path to Galaxy client")
|
||||
parser.add_argument("--client-path", "-n", help="Path to Galaxy client")
|
||||
args = parser.parse_args()
|
||||
if args.config:
|
||||
os.environ["GALAXY_CONFIG_FILE"] = args.config
|
||||
if args.single_user:
|
||||
os.environ["GALAXY_CONFIG_SINGLE_USER"] = args.single_user
|
||||
os.environ["GALAXY_CONFIG_ADMIN_USERS"] = args.single_user
|
||||
os.environ["GALAXY_CONFIG_STATIC_DIR"] = args.client_path
|
||||
if args.client_path:
|
||||
os.environ["GALAXY_CONFIG_STATIC_DIR"] = args.client_path
|
||||
uvicorn.run(
|
||||
"galaxy.webapps.galaxy.fast_factory:factory",
|
||||
factory=True,
|
||||
|
||||
Reference in New Issue
Block a user