|
Size: 769
Comment:
|
Size: 1346
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| <<TableOfContents(2)>> | |
| Line 7: | Line 8: |
| {{{#!highlight bash | {{{#!highlight sh |
| Line 12: | Line 13: |
| python3 -m venv virtenv . virtenv/bin/activate |
python3 -m venv venv . venv/bin/activate # pip install -r requirements.txt |
| Line 15: | Line 17: |
| find . virtenv/ | find . venv/ ./venv/bin/python -V ./venv/bin/python |
| Line 18: | Line 22: |
| * nano flaskproj.py | === static/app.css === {{{#!highlight css .p{ text-align: center; } }}} === static/app.js === {{{#!highlight javascript document.addEventListener("DOMContentLoaded", (event) => { console.log("DOM is ready!"); }); }}} === templates/index.html === {{{#!highlight html <html> <head> <link href="static/app.css" rel="stylesheet"> <script src="static/app.js"></script> </head> <body> <p>Hello Flask</p> </body> </html> }}} === flaskproj.py === |
| Line 20: | Line 49: |
| from flask import Flask | from flask import Flask, render_template |
| Line 26: | Line 55: |
| return "<p>Hello World from Flask!</p>" | return render_template("index.html") |
Flask
- Micro web development framework
- Flask depends on the Jinja template engine and the Werkzeug WSGI toolkit.
Example
static/app.css
1 .p{ text-align: center; }
static/app.js
templates/index.html
