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
***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/)are needed to run globally.**
2546
-
2544
+
***Starts the app at`'http://localhost:5000'`. Use `'host="0.0.0.0"'` to run externally.**
2545
+
***Install 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/)for better security.**
2546
+
***Debug mode restarts the app whenever script changes and displays errors in the browser.**
<li><strong>Starts the app on <codeclass="python hljs"><spanclass="hljs-string">'http://localhost:5000'</span></code>.</strong></li>
2086
-
<li><strong>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> are needed to run globally.</strong></li>
2085
+
<li><strong>Starts the app at <codeclass="python hljs"><spanclass="hljs-string">'http://localhost:5000'</span></code>. Use <codeclass="python hljs"><spanclass="hljs-string">'host="0.0.0.0"'</span></code> to run externally.</strong></li>
2086
+
<li><strong>Install 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> for better security.</strong></li>
2087
+
<li><strong>Debug mode restarts the app whenever script changes and displays errors in the browser.</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>
2100
+
<li><strong>To return an error code use <codeclass="python hljs"><spanclass="hljs-string">'abort(<int>)'</span></code> and to redirect use <codeclass="python hljs"><spanclass="hljs-string">'redirect(<url>)'</span></code>.</strong></li>
2101
+
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'request.args[<str>]'</span></code> returns parameter from the query string (URL part after the ?).</strong></li>
2102
+
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'session[key] = value'</span></code> to store session data like username, etc.</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>
<div><h4id="startstheappinitsownthreadandqueriesitwithapostrequest">Starts the app in its own thread and queries it with a post request:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install requests</span>
0 commit comments