Skip to content

Commit

Permalink
fixes #569
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Oct 19, 2022
1 parent 2c3dfc7 commit 8d451a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions examples/demo_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,16 @@ class DemoBrowser(BaseWebPage):
"""
Browser for demos
"""
def __init__(self,base_path:str=None):
def __init__(self,base_path:str=None,debug:bool=False):
"""
constructor
Args:
base_path(str): the path to search examples in
debug(bool): if True switchon debugging
"""
BaseWebPage.__init__(self)
self.demo_starter=Demostarter(base_path=base_path)
self.demo_starter=Demostarter(base_path=base_path,debug=debug)
self.tutorial_manager=TutorialManager()
jp.app.add_jproute("/demo/{demo_name}",self.show_demo)
self.mounted={}
Expand Down Expand Up @@ -437,6 +438,9 @@ def main(argv=None): # IGNORE:C0111
parser.add_argument(
"-d", "--debug", dest="debug", action="store_true", help="show debug info"
)
parser.add_argument(
"--heroku", action="store_true", help="in heroku environment pick up port from env variable and set host to 0.0.0.0"
)
script_dir = os.path.dirname(__file__)
parser.add_argument(
"-p",
Expand All @@ -447,7 +451,10 @@ def main(argv=None): # IGNORE:C0111
parser.add_argument("--host", default=socket.getfqdn())
parser.add_argument("--port", type=int, default=8000)
args = parser.parse_args(argv[1:])
demo_browser=DemoBrowser(base_path=args.path)
demo_browser=DemoBrowser(base_path=args.path,debug=args.debug)
if args.heroku:
args.port=os.environ["PORT"]
args.host="0.0.0.0"
jp.justpy(demo_browser.web_page,host=args.host, port=args.port,PLOTLY=True,KATEX=True,VEGA=True)
except Exception as e:
indent = len(program_name) * " "
Expand Down
2 changes: 1 addition & 1 deletion justpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""JustPy is an object-oriented, component based, high-level Python Web Framework that requires no front-end programming"""
from .justpy import *

__version__ = "0.9.7"
__version__ = "0.9.8"

0 comments on commit 8d451a8

Please sign in to comment.