Skip to content

Commit

Permalink
fixes #395
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Aug 27, 2022
1 parent ee3ae32 commit 51eb5d5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions justpy/justpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from starlette.responses import PlainTextResponse
from starlette.endpoints import WebSocketEndpoint
from starlette.endpoints import HTTPEndpoint
from starlette.middleware import Middleware
from starlette.middleware.gzip import GZipMiddleware
from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware
from starlette.staticfiles import StaticFiles
Expand Down Expand Up @@ -86,13 +87,14 @@ def create_component_file_list():
'katex': KATEX, 'plotly': PLOTLY, 'bokeh': BOKEH, 'deckgl': DECKGL, 'vega': VEGA}
logging.basicConfig(level=LOGGING_LEVEL, format='%(levelname)s %(module)s: %(message)s')


app = Starlette(debug=DEBUG)
# modify middleware handling according to deprecation
# https://github.com/encode/starlette/discussions/1762
middleware =[Middleware(GZipMiddleware)]
if SSL_KEYFILE and SSL_CERTFILE:
middleware.append(Middleware(HTTPSRedirectMiddleware))
app = Starlette(middleware=middleware,debug=DEBUG)
app.mount(STATIC_ROUTE, StaticFiles(directory=STATIC_DIRECTORY), name=STATIC_NAME)
app.mount('/templates', StaticFiles(directory=current_dir + '/templates'), name='templates')
app.add_middleware(GZipMiddleware)
if SSL_KEYFILE and SSL_CERTFILE:
app.add_middleware(HTTPSRedirectMiddleware)


def initial_func(request):
Expand Down

0 comments on commit 51eb5d5

Please sign in to comment.