mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-24 05:15:47 +03:00
Please add a startup flag to select an alternate web server static file path #2612
This commit is contained in:
parent
f2b232ebaf
commit
df66a7ffe9
10
README.rst
10
README.rst
@ -201,8 +201,8 @@ or
|
|||||||
*Note*: This is only supported on some GNU/Linux distributions and Mac OS X.
|
*Note*: This is only supported on some GNU/Linux distributions and Mac OS X.
|
||||||
If you want to support other distributions, please contribute to `glancesautoinstall`_.
|
If you want to support other distributions, please contribute to `glancesautoinstall`_.
|
||||||
|
|
||||||
Docker: the fun way
|
Docker: the cloudy way
|
||||||
-------------------
|
----------------------
|
||||||
|
|
||||||
Glances Docker images are availables. You can use it to monitor your
|
Glances Docker images are availables. You can use it to monitor your
|
||||||
server and all your containers !
|
server and all your containers !
|
||||||
@ -268,7 +268,8 @@ may not be the latest version and only basics plugins are enabled.
|
|||||||
Note: The Debian package (and all other Debian-based distributions) do
|
Note: The Debian package (and all other Debian-based distributions) do
|
||||||
not include anymore the JS statics files used by the Web interface
|
not include anymore the JS statics files used by the Web interface
|
||||||
(see ``issue2021``). If you want to add it to your Glances installation,
|
(see ``issue2021``). If you want to add it to your Glances installation,
|
||||||
follow the instructions: ``issue2021comment``.
|
follow the instructions: ``issue2021comment``. In Glances version 4 and
|
||||||
|
higher, the path to the statics file is configurable (see ``issue2612``).
|
||||||
|
|
||||||
FreeBSD
|
FreeBSD
|
||||||
-------
|
-------
|
||||||
@ -490,6 +491,7 @@ Glances is distributed under the LGPL version 3 license. See ``COPYING`` for mor
|
|||||||
.. _package: https://repology.org/project/glances/versions
|
.. _package: https://repology.org/project/glances/versions
|
||||||
.. _sponsors: https://github.com/sponsors/nicolargo
|
.. _sponsors: https://github.com/sponsors/nicolargo
|
||||||
.. _wishlist: https://www.amazon.fr/hz/wishlist/ls/BWAAQKWFR3FI?ref_=wl_share
|
.. _wishlist: https://www.amazon.fr/hz/wishlist/ls/BWAAQKWFR3FI?ref_=wl_share
|
||||||
.. _issue2021: https://github.com/nicolargo/glances/issues/2021#issuecomment-1197831157
|
.. _issue2021: https://github.com/nicolargo/glances/issues/2021
|
||||||
.. _issue2021comment: https://github.com/nicolargo/glances/issues/2021#issuecomment-1197831157
|
.. _issue2021comment: https://github.com/nicolargo/glances/issues/2021#issuecomment-1197831157
|
||||||
|
.. _issue2612: https://github.com/nicolargo/glances/issues/2612
|
||||||
.. _Docker: https://github.com/nicolargo/glances/blob/develop/docs/docker.rst
|
.. _Docker: https://github.com/nicolargo/glances/blob/develop/docs/docker.rst
|
||||||
|
@ -29,11 +29,18 @@ separator=True
|
|||||||
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
|
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
|
||||||
# Limit the number of processes to display (for the WebUI)
|
# Limit the number of processes to display (for the WebUI)
|
||||||
max_processes_display=25
|
max_processes_display=25
|
||||||
# Set the URL prefix (for the WebUI and the API)
|
# Set URL prefix for the WebUI and the API
|
||||||
# Example: url_prefix=/glances/ => http://localhost/glances/
|
# Example: url_prefix=/glances/ => http://localhost/glances/
|
||||||
# The final / is mandatory
|
# Note: The final / is mandatory
|
||||||
# Default is no prefix (/)
|
# Default is no prefix (/)
|
||||||
#url_prefix=/glances/
|
#url_prefix=/glances/
|
||||||
|
# Set root path for WebUI statics files
|
||||||
|
# Why ? On Debian system, WebUI statics files are not provided.
|
||||||
|
# You can download it in a specific folder
|
||||||
|
# thanks to https://github.com/nicolargo/glances/issues/2021
|
||||||
|
# then configure this folder with the webui_root_path key
|
||||||
|
# Default is folder where glances_restfull_api.py is hosted
|
||||||
|
#webui_root_path=
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# plugins
|
# plugins
|
||||||
|
@ -29,11 +29,18 @@ separator=True
|
|||||||
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
|
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
|
||||||
# Limit the number of processes to display (for the WebUI)
|
# Limit the number of processes to display (for the WebUI)
|
||||||
max_processes_display=25
|
max_processes_display=25
|
||||||
# Set the URL prefix (for the WebUI and the API)
|
# Set URL prefix for the WebUI and the API
|
||||||
# Example: url_prefix=/glances/ => http://localhost/glances/
|
# Example: url_prefix=/glances/ => http://localhost/glances/
|
||||||
# The final / is mandatory
|
# Note: The final / is mandatory
|
||||||
# Default is no prefix (/)
|
# Default is no prefix (/)
|
||||||
#url_prefix=/glances/
|
#url_prefix=/glances/
|
||||||
|
# Set root path for WebUI statics files
|
||||||
|
# Why ? On Debian system, WebUI statics files are not provided.
|
||||||
|
# You can download it in a specific folder
|
||||||
|
# thanks to https://github.com/nicolargo/glances/issues/2021
|
||||||
|
# then configure this folder with the webui_root_path key
|
||||||
|
# Default is folder where glances_restfull_api.py is hosted
|
||||||
|
#webui_root_path=
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# plugins
|
# plugins
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of Glances.
|
# This file is part of Glances.
|
||||||
#
|
#
|
||||||
# SPDX-FileCopyrightText: 2023 Nicolas Hennion <nicolas@nicolargo.com>
|
# SPDX-FileCopyrightText: 2024 Nicolas Hennion <nicolas@nicolargo.com>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: LGPL-3.0-only
|
# SPDX-License-Identifier: LGPL-3.0-only
|
||||||
#
|
#
|
||||||
@ -14,7 +14,6 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
from io import open
|
from io import open
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import socket
|
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
# Replace typing_extensions by typing when Python 3.8 support will be dropped
|
# Replace typing_extensions by typing when Python 3.8 support will be dropped
|
||||||
@ -115,8 +114,13 @@ class GlancesRestfulApi(object):
|
|||||||
self._app.include_router(APIRouter(prefix=self.url_prefix.rstrip('/')))
|
self._app.include_router(APIRouter(prefix=self.url_prefix.rstrip('/')))
|
||||||
|
|
||||||
# Set path for WebUI
|
# Set path for WebUI
|
||||||
self.STATIC_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/public')
|
webui_root_path = config.get_value('outputs',
|
||||||
self.TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/templates')
|
'webui_root_path',
|
||||||
|
default=os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
if webui_root_path == '':
|
||||||
|
webui_root_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
self.STATIC_PATH = os.path.join(webui_root_path, 'static/public')
|
||||||
|
self.TEMPLATE_PATH = os.path.join(webui_root_path, 'static/templates')
|
||||||
self._templates = Jinja2Templates(directory=self.TEMPLATE_PATH)
|
self._templates = Jinja2Templates(directory=self.TEMPLATE_PATH)
|
||||||
|
|
||||||
# FastAPI Enable CORS
|
# FastAPI Enable CORS
|
||||||
|
Loading…
Reference in New Issue
Block a user