PyFlaskBootstrap4: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 11: | Line 11: | ||
<source lang='bash'> | <source lang='bash'> | ||
pip install pyFlaskBootstrap4 | pip install pyFlaskBootstrap4 | ||
</source> | |||
= Tutorial = | |||
== HelloWeb application == | |||
<source lang='python'> | |||
''' | |||
Created on 2021-01-08 | |||
This is a demo application for https://github.com/WolfgangFahl/pyFlaskBootstrap4 | |||
@author: wf | |||
''' | |||
from fb4.app import AppWrap | |||
from flask import render_template | |||
class HelloWeb(AppWrap): | |||
''' | |||
a sample web application | |||
''' | |||
def __init__(self): | |||
''' | |||
Constructor | |||
''' | |||
super().__init__() | |||
def home(self): | |||
''' | |||
render the home page of the HelloWeb application | |||
''' | |||
html = render_template("bootstrap.html", title="HelloWeb demo application",content="Welcome to the Flask + Bootstrap4 Demo web application",error=None) | |||
return html | |||
helloWeb=HelloWeb() | |||
app=helloWeb.app | |||
@app.route('/') | |||
def home(): | |||
return helloWeb.home() | |||
if __name__ == '__main__': | |||
parser=helloWeb.getParser("Flask + Bootstrap4 Demo Web Application") | |||
args=parser.parse_args() | |||
helloWeb.optionalDebug(args) | |||
helloWeb.run(args) | |||
</source> | </source> | ||
Revision as of 10:03, 9 January 2021
| OsProject | |
|---|---|
| id | PyFlaskBootstrap4 |
| state | |
| owner | WolfgangFahl |
| title | Flask + Bootstrap 4 static components and templates for webprojects |
| url | https://github.com/WolfgangFahl/pyFlaskBootstrap4 |
| version | 0.0.3 |
| description | |
| date | 2021/01/08 |
| since | |
| until | |
Installation
pip install pyFlaskBootstrap4
Tutorial
HelloWeb application
'''
Created on 2021-01-08
This is a demo application for https://github.com/WolfgangFahl/pyFlaskBootstrap4
@author: wf
'''
from fb4.app import AppWrap
from flask import render_template
class HelloWeb(AppWrap):
'''
a sample web application
'''
def __init__(self):
'''
Constructor
'''
super().__init__()
def home(self):
'''
render the home page of the HelloWeb application
'''
html = render_template("bootstrap.html", title="HelloWeb demo application",content="Welcome to the Flask + Bootstrap4 Demo web application",error=None)
return html
helloWeb=HelloWeb()
app=helloWeb.app
@app.route('/')
def home():
return helloWeb.home()
if __name__ == '__main__':
parser=helloWeb.getParser("Flask + Bootstrap4 Demo Web Application")
args=parser.parse_args()
helloWeb.optionalDebug(args)
helloWeb.run(args)