Giter VIP home page Giter VIP logo

flask-practice's Introduction

Flask Practice

About Flask

Flask is a highly used Python micro Web Framework. It provides basic functionality to build web applications, like routing, request/response handling, etc. It's a "small" framework compared to other ones (like Django), but in many cases that's a great advantage.

Install Instructions

Fork this repo and create a new cloud9 workspace as we do with other projects. Then follow the usual steps:

$ mkvirtualenv flask-practice -p /usr/bin/python3
$ pip install -r requirements.txt

Running the app server

Flask framework provides, out of the box, a way to run a development web server in your local machine. Just execute the run_app.py script available in the project and the application will stay listening at localhost:8080. (Make sure to have all the requirements previously installed)

$ python run_app.py

Running tests

Tests are split among several functions. You can run them all together doing pytest tests.py or select individual based on keyword expressions like pytest -k 'test_1' tests.py.

Tasks

1. Implement a simple Welcome view

This view was done for you as an example. Just implemented a basic view on / URL that returns a string welcoming to your Flask practice

2. Implement a view that receives URL parameters

This one was also done as an example. In this case, the view receives two numbers as URL parameters, and returns the sum of them in a formatted string.

i.e: Sending /sum/100/200, the response would be: "The sum of 100 and 200 is: 300"

3. Implement a view that builds usernames

In this case, you'll have to implement a view that receives user's first name and last name, and builds its lowercase username using first letter of the first name, concatenated with the last name. (Remember to validate that given parameters are strings)

i.e: Sending /username/Elon/Musk will return emusk

4. Implement a view with query parameters

For this exercise, you'll have to implement a view that receives a ?search= query parameter in the URL, and returns the amount of users in the given users_list that contains that search string in their names.

i.e: /user?search=mo will return 'Found 2 users that match with search "mo"'

flask-practice's People

Contributors

ivanzugnoni avatar santiagobasulto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.