Nextjournal / Jan 05 2021
Minimal Flask Template
from threading import Threadimport os; from urllib.parse import urlparsenj_service_url = urlparse(os.environ.get('NEXTJOURNAL_RUNTIME_SERVICE_URL'))nj_service_url.path0.1s
Simple Flask Example (Python)
Flask
from flask import Flask app = Flask('flasky') .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 IFrameIFrame(nj_service_url.path, '100%', 400)0.4s
Simple Flask Example (Python)
Flask
Flask Env
pip install flask5.2s
Flask (Bash)