Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Python module Y307
The Flask micro webdevelopment framework for Python
Exercises, examples and other material relating to training module Y307. This module is presented on Private Courses and Specially Run Courses only

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. Running as a server, requests are routed via Werkzeug and pages generated (templated) through Jinja, providing a toolset to allow Python applications to be run on a web server / accessed via a browser without tedious coding, and leading to a fast development cycle.
Articles and tips on this subjectupdated
4540Unittest of a Flask application including forms
Moving on from the single file "Hello Flask Test World" at [here], I've now uploaded an example that takes a Flask application including a form - it's [here] and based on our earlier form demo and runs it through unit test [here]. It runs with all tests passing:   WomanWithCat:flask grahamellis$ ...
4538Flask and unittest - hello web app test world
Flask comes with a test client that you can use within unittest - I've put together a really short test of "hello world" [here]. The test example is ugly with the Flask application within the test harness, and should be improved by the importing of the appication to be tested. ...
4534Flask - complete MVC site to navigate around a data set
A full demonstration from today - Flask Model, View and Controller. There's an index page listing links to all UK railway stations, and individual pages (via a 3 letter code URL) for each station. Here's the log of a session: and some of the pages in that session:     The main router ...
4533Sessions in flask
Sessions are available in flask through the session object which can be treated as a python dict. There's an example which srores anyone filling in the "Hello" page on our signin form [here] and the template associated wit it is [here].       ...
4532Flask - first forms and responses with wtforms
Using Flask, the wtforms module lets you set up your own forms - example [here] with the jinja template [here]. This example sets the for up, but does not handle reponses - indeed, a form submitted back will generate an error 405 and I have used this opportunity to use the app.errorhandler decorator ...
4531Jinja2 - Flask templating
So far, we've only done simple inserts in our template - but there may be a requirement to do more - for example to insert a whole table of values. And this requires programatic elements in our template. Whilst it would be nice if we could simply include Python code in our template (Like Ruby on Rails ...
4530Requests in Flask
Your request object contains many fields of information - you can access the query string and the headers as well as individual parameters entered into forms using the GET or the POST methods, or both. There are various layers of dispatch of requests (we can come back to these later) - just look at the ...
4529Flask - calling in the templating engine
In previous steps, we have set up flask [here] and done some routing [here]. Let's now define our view. Our view is in HTML (and with style and lots of other stuff later) and the template will be produced by an HTML expert and graphic artist, and not by a programmer. It will be in a separate place ...
4528Routing in Flask
Having got "hello world" working on your server in Flask (see [here] if you haven't!), you'll want to add further routes for other URLs - and indeed you'll want those routes to contain match markers so you can set up whole families of URLs. Our first example included:   @app.route("/")   def ...
4527Hello Flask world / Python web micro framework
Flask is a microframework for web appliactions - in other words, it provides the structure for you to write web based applications on your server in Python without the need to get involved with detailed coding common to most applications - allyou need to is to take the framework provided and fill in ...
Examples from our training material
allstations.html   jinja2 MVC inner template - station index page
astation.html   jinja2 MVC inner template - iindividual station page
base.html   base html - supertemplate - for rrt
basestation.html   jinja2 MVC - common outer template
features.html   features of jinja2 for rrt demo
first   Hello Flask World
firstform.html   Form - Jinja2
flask_app_test   Running Flask unittest with form and POST method
flask_test   Running Flask with template in unittest
fltest   Running Flask in unittest
person.html   Template for "third" flask example
requestresponse.html   template for request / response demo
rrc   Flask with request - response cycle
rrt   Flask - Jinja 2 introduction
rrw   Flask first form
rrx   Flask - form that picks up answer
rrx.py   Flask form demo / tuned to also work under unittest
rry   Flask - form that stores answers in sessions
rstats2014.xyz   data for stations.py demo
second   Flask with routing
secondform.html   Form and response - Jinja2
station_model.py   model - first flask MVC demo
stations.py   Flask Station Navigator - Router and controller for MVC demo
third   Flask with routing and templates
thirdform.html   template including session report
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
Basic Flask application structure; virtual environments
Server, routes, views, request / response cycle under Flask
The Jinja2 tempting engine, including nested templates, forms,
Routing and redirects
Databases with SQL
Request, configuration and Responses
Testing, faking, error handling, Unit testing, Code coverage
Callbacks, Pluggable views, Blueprints
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.info/resources/Y307.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb