mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
handler of static files was moved to webserver module
This commit is contained in:
parent
1243b27af2
commit
a1bfefad9c
2 changed files with 11 additions and 3 deletions
|
|
@ -107,7 +107,6 @@ class RestApiModule(PypeModule, ITrayService):
|
|||
|
||||
self.rest_api_url = None
|
||||
self.rest_api_thread = None
|
||||
self.resources_url = None
|
||||
|
||||
def register_callback(
|
||||
self, path, callback, url_prefix="", methods=[], strict_match=False
|
||||
|
|
@ -189,11 +188,9 @@ class RestApiModule(PypeModule, ITrayService):
|
|||
self.rest_api_url = "http://localhost:{}".format(port)
|
||||
self.rest_api_thread = RestApiThread(self, port)
|
||||
self.register_statics("/res", resources.RESOURCES_DIR)
|
||||
self.resources_url = "{}/res".format(self.rest_api_url)
|
||||
|
||||
# Set rest api environments
|
||||
os.environ["PYPE_REST_API_URL"] = self.rest_api_url
|
||||
os.environ["PYPE_STATICS_SERVER"] = self.resources_url
|
||||
|
||||
def tray_start(self):
|
||||
RestApiFactory.prepare_registered()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
from pype import resources
|
||||
from .. import PypeModule, ITrayService
|
||||
|
||||
|
||||
|
|
@ -17,6 +19,7 @@ class WebServerModule(PypeModule, ITrayService):
|
|||
|
||||
def tray_init(self):
|
||||
self.create_server_manager()
|
||||
self._add_resources_statics()
|
||||
|
||||
def tray_start(self):
|
||||
self.start_server()
|
||||
|
|
@ -24,6 +27,14 @@ class WebServerModule(PypeModule, ITrayService):
|
|||
def tray_exit(self):
|
||||
self.stop_server()
|
||||
|
||||
def _add_resources_statics(self):
|
||||
static_prefix = "/res"
|
||||
self.server_manager.add_static(static_prefix, resources.RESOURCES_DIR)
|
||||
|
||||
os.environ["PYPE_STATICS_SERVER"] = "http://localhost:{}{}".format(
|
||||
self.port, static_prefix
|
||||
)
|
||||
|
||||
def start_server(self):
|
||||
if self.server_manager:
|
||||
self.server_manager.start_server()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue