You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Bottle is a micro web framework/server. If you just want to open a html file in a web browser use `'webbrowser.open(<path>)'` instead.**
2528
+
**Flask is a micro web framework/server. If you just want to open a html file in a web browser use `'webbrowser.open(<path>)'` instead.**
2529
2529
```python
2530
-
# $ pip3 install bottle
2531
-
from bottle import run, route, static_file, template, post, request, response
2532
-
import json
2530
+
# $ pip3 install flask
2531
+
from flask import Flask, send_from_directory, render_template_string, request
2533
2532
```
2534
2533
2535
-
### Run
2536
2534
```python
2537
-
run(host='localhost', port=8080) # Runs locally.
2538
-
run(host='0.0.0.0', port=80) # Runs globally.
2535
+
app = Flask(__name__)
2536
+
app.run()
2539
2537
```
2538
+
***Starts the app on `'http://localhost:5000'`.**
2539
+
***You will need a WSGI server like [waitress](https://flask.palletsprojects.com/en/latest/deploying/waitress/) and a HTTP server such as [nginx](https://flask.palletsprojects.com/en/latest/deploying/nginx/) to run globally.**
<div><h2id="web"><ahref="#web" name="web">#</a>Web</h2><p><strong>Bottle is a micro web framework/server. If you just want to open a html file in a web browser use <codeclass="python hljs"><spanclass="hljs-string">'webbrowser.open(<path>)'</span></code> instead.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install bottle</span>
2075
-
<spanclass="hljs-keyword">from</span> bottle <spanclass="hljs-keyword">import</span> run, route, static_file, template, post, request, response
2076
-
<spanclass="hljs-keyword">import</span> json
2074
+
<div><h2id="web"><ahref="#web" name="web">#</a>Web</h2><p><strong>Flask is a micro web framework/server. If you just want to open a html file in a web browser use <codeclass="python hljs"><spanclass="hljs-string">'webbrowser.open(<path>)'</span></code> instead.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install flask</span>
<li><strong>Starts the app on <codeclass="python hljs"><spanclass="hljs-string">'http://localhost:5000'</span></code>.</strong></li>
2084
+
<li><strong>You will need a WSGI server like <ahref="https://flask.palletsprojects.com/en/latest/deploying/waitress/">waitress</a> and a HTTP server such as <ahref="https://flask.palletsprojects.com/en/latest/deploying/nginx/">nginx</a> to run globally.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'render_template()'</span></code> accepts filename of a template stored in 'templates' directory.</strong></li>
<li><strong>To get a parameter from the query string (part after the ?) use <codeclass="python hljs"><spanclass="hljs-string">'request.args.get(<str>)'</span></code>.</strong></li>
0 commit comments