Minimal Flask Template

from threading import Thread
import os; from urllib.parse import urlparse
nj_service_url = urlparse(os.environ.get('NEXTJOURNAL_RUNTIME_SERVICE_URL'))
nj_service_url.path
0.1s
Simple Flask Example (Python)
Flask
from flask import Flask 
 
app = Flask('flasky') 
@app.route('/')
def hello_world(): 
  return '<h1>🍾 Hello, Flask!<h1>'
def run():
  app.run('0.0.0.0', 9998)
thread = Thread(target=run)
thread.setDaemon(True)
thread.start()
0.6s
Simple Flask Example (Python)
Flask
from IPython.display import IFrame
IFrame(nj_service_url.path, '100%', 400)
0.4s
Simple Flask Example (Python)
Flask

Flask Env

pip install flask
5.2s
Flask (Bash)
Runtimes (2)