GithubHelp home page GithubHelp logo

stringtheory92 / python-p4-routing-and-views-lab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-curriculum/python-p4-routing-and-views-lab

0.0 0.0 0.0 43 KB

License: Other

Python 100.00%

python-p4-routing-and-views-lab's Introduction

Flask Routing and Views Lab

Learning Goals

  • Build and run a Flask application on your computer.
  • Manipulate and test the structure of a request object.

Key Vocab

  • Web Framework: software that is designed to support the development of web applications. Web frameworks provide built-in tools for generating web servers, turning Python objects into HTML, and more.
  • Extension: a package or module that adds functionality to a Flask application that it does not have by default.
  • Request: an attempt by one machine to contact another over the internet.
  • Client: an application or machine that accesses services being provided by a server through the internet.
  • Web Server: a combination of software and hardware that uses Hypertext Transfer Protocol (HTTP) and other protocols to respond to requests made over the internet.
  • Web Server Gateway Interface (WSGI): an interface between web servers and applications.
  • Template Engine: software that takes in strings with tokenized values, replacing the tokens with their values as output in a web browser.

Instructions

This is a test-driven lab. Run pipenv install to create your virtual environment and pipenv shell to enter the virtual environment. Then enter the server/ directory and run pytest -x to run your tests. Use these instructions and pytest's error messages to complete your work in the server/ directory. If you prefer working in a Flask environment to running your application as a script, remember to configure it with the following commands from the server/ directory:

$ export FLASK_APP=app.py
$ export FLASK_RUN_PORT=5555

Instructions begin here:

  • Design a Flask application that carries out basic Python functions using routing and views.
  • Your index() view should be routed to at the base URL with /. It should Contain an h1 element that contains the title of this application, "Python Operations with Flask Routing and Views".
  • A print_string view should take one parameter, a string. It should print the string in the console and display it in the web browser. Its URL should be of the format /print/parameter.
  • A count() view should take one parameter, an integer. It should display all numbers in the range of that parameter on separate lines. Its URL should be of the format /count/parameter.
  • A math() view should take three parameters: num1, operation, and num2. It must perform the appropriate operation on the two numbers in the order that they are presented. The included operations should be: +, -, *, div (/ would change the URL path), and %. Its URL should be of the format /math/<num1><operation><num2>.

Once all of your tests are passing, commit and push your work using git to submit.


Resources

python-p4-routing-and-views-lab's People

Contributors

professor-ben avatar jlboba 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.