Monthly Archives: September 2015

Linux meetup : An introduction to Flask by Avinash Meetoo

Flask is a web microframework which was created by Armin Ronacher of Pocoo and it is written in python. The “micro” in microframework means Flask aims to keep the core simple but extensible.

Flask is based on MVC Web Architecture which allows you to have models, views and controllers and plugins can be added to make it more powerful. LinkedIn and Pinterest both make use of Flask.
Flask is considered more Pythonic than Django because Flask web application code is in most cases more explicit.

The following code below shows a simple web application which was explained by Avinash Meetoo during the Linux meetup.


from flask import Flask
// First we import the Flask class.
From flask import render_template
// render_template is a function being imported from module flask.
app = Flask(__name__)
// Next we create an instance of this class called app which is basically a controller.
// (__name__)is needed so that Flask knows where to look for the assets like css, js and templates.
@app.route('/')
//Next, we define route for the home of the web application, which is accessed through the url – localhost:5000/
def home():
return render_template(‘home.html’)

// home() is the function that is executed each time a request come to this route (‘/’). In this function, it is going to render a template which is ‘home.html’.
if __name__ == '__main__':
// makes sure the server only runs if the script is executed directly from the Python interpreter and not used as an imported module.
app.run(debug = True)
// Finally we use the run () function to run the local server with our application.

 

“demo.py” was used as the controller to render the template ‘home.html’ .

During this presentation, Avinash Meetoo explained the codes and functionalities that he used when he created a web application for the general elections in 2014. “electionsmauritius.py” was used as the controller to run the application.
Flask is easy to get started with as a beginner because there is little boilerplate code for getting a simple app up and running.
The presentation can be found on the YouTube link below:

 

Summary done by Neha Gunnoo.

 

Opensource Web application in Collaboration with Government Agency

The Data Protection Office has a self-assessment questionnaire ( http://dataprotection.govmu.org/English//DOCUMENTS/SELF%20ASSESSMENT%20PDF.PDF ) for compliance with Data Protection obligations. Doing such an assessment on paper and evaluating the results can be a cumbersome process.

Subramanian Moonesamy, Ishwon K. Sookun, Bundhoo Mohammad Nadim, Tejas Pagooah and Ajay Ramjatan volunteered five months of time and effort to develop a Privacy Compliance Assessment Webapp in collaboration with the Data Protection Office to make the process as user-friendly as possible. The Web app can be accessed at http://www.elandsys.com/~sm/privacy-mu/

DPO-webapp

 

It is the first time a group of volunteers in Mauritius develop an Open Source Software project in collaboration with a government agency. It was also to showcase responsive web design, i.e. the Webapp looks good on a desktop, tablet or a mobile.

The webapp does not store cookies, nor uses any other web tracking mechanism. Hence anyone who conducts an assessment using this webapp can do it anonymously, without any fear of being tracked.

The webapp is free software and can be freely distributed or modified under GNU General Public License.