Mini Project 2 - Web App Development
18 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary software requirement mentioned for completing the mini project?

  • Git (correct)
  • Java
  • Python
  • Node.js

Which folder is referred to as the root folder of the application?

  • app_root
  • mini_project
  • project_base
  • mp_calc (correct)

What command should be run in the terminal to enter the virtual environment?

  • activate_env
  • venv activate
  • pipenv shell (correct)
  • env activate

Where can you find instructions for the mini project in the file structure?

<p>Readme.md (D)</p> Signup and view all the answers

What command should you run to install the packages listed in the Pipfile?

<p>pipenv install (B)</p> Signup and view all the answers

What framework is utilized for creating the web app in this mini project?

<p>Flask (A)</p> Signup and view all the answers

What should you do if you encounter a message about adding pipenv to the PATH?

<p>Run a specific command in the terminal (C)</p> Signup and view all the answers

How do you exit the virtual environment at the end of a session?

<p>deactivate (A)</p> Signup and view all the answers

What should be done after modifying the mergesort() function in serverlibrary.py?

<p>Compile clientlibrary.py using Transcrypt. (B)</p> Signup and view all the answers

Which file contains the definition for the db object needed for the application?

<p><strong>init</strong>.py (A)</p> Signup and view all the answers

What is the role of the routes.py file in the application?

<p>It defines how URLs are routed within the application. (D)</p> Signup and view all the answers

What should be done in the templates folder for Exercise 1?

<p>Replace #Replace Me# with jinja templating code. (D)</p> Signup and view all the answers

How can you check if the target folder was created successfully after compiling clientlibrary.py?

<p>By typing a specific command in the terminal. (A)</p> Signup and view all the answers

Which command is necessary to run the web application after setting up the database?

<p>flask run (A)</p> Signup and view all the answers

What is the expected output when the users are displayed in the web application?

<p>Users sorted according to their usernames. (C)</p> Signup and view all the answers

What programming language is used to implement the EvaluateExpression and Stack classes?

<p>Python (C)</p> Signup and view all the answers

In what specific form should the users be shown in users.html?

<p>In rows of a table. (D)</p> Signup and view all the answers

What command is used to stop the web application that is running?

<p>CTRL + C (A)</p> Signup and view all the answers

Flashcards

Web App for Math Quiz

A web application designed to create and play math quizzes for integer arithmetic.

Git

Version control system for managing project files and changes.

Clone Repository

To create a copy of a remote repository on your local machine.

Virtual Environment

A self-contained directory for managing project-specific packages and their dependencies.

Signup and view all the flashcards

Pipenv

A tool to manage project dependencies and virtual environments.

Signup and view all the flashcards

Flask

A Python web framework used for building web applications.

Signup and view all the flashcards

Application.py

Python file containing the main logic for the web application, typically using Flask.

Signup and view all the flashcards

Anaconda Prompt

Command-line interface often used to manage and run Python applications, particularly in data science, specifically in Vocareum.

Signup and view all the flashcards

Compiling clientlibrary.py

Using Transcrypt to convert client-side JavaScript code from clientlibrary.py (in app/static) into browser-usable code. This is a prerequisite for running the web application.

Signup and view all the flashcards

Setting up the database

Creating the database (app.db) and migration folder to store database changes.

Signup and view all the flashcards

Running Flask

Executing the Flask web application server.

Signup and view all the flashcards

users.html

HTML template file for displaying a table of users.

Signup and view all the flashcards

Jinja templating

A templating language used to dynamically generate HTML, including user data from the database

Signup and view all the flashcards

serverlibrary.py

Python file containing server-side logic, including data handling, routing and functions needed.

Signup and view all the flashcards

app/static/clientlibrary.py

Python file storing JavaScript library code for the client-side user interface.

Signup and view all the flashcards

Transcrypt

Tool for converting Python code to Javascript code.

Signup and view all the flashcards

mp2_exercises.ipynb

Ipython Notebook containing mini project 2 exercises (including Q1-Q2).

Signup and view all the flashcards

Mergesort

Sorting algorithm; needed to sort data.

Signup and view all the flashcards

Study Notes

Mini Project 2 - Web App Development (Math Quiz)

  • Project Goal: Develop a web application for integer arithmetic quizzes.
  • Prerequisites: Git installation.
  • Project Setup:
    • Clone the repository: git clone <repo URL>
    • Navigate to the mp_calc folder for this mini-project.
    • Install pipenv: (Windows/Linux commands provided)
    • Add pipenv to PATH (if needed for Vocareum Linux shell): (Command provided).
    • Install packages specified in Pipfile using pipenv install.
    • Activate virtual environment: pipenv shell (or prepend commands with pipenv run)
    • Verify virtualenv activation: Check for (mp_calc) in your prompt
    • Terminate virtual environment: exit

Application Structure and Files

  • Key Files: application.py, app/__init__.py, app/routes.py, templates/users.html, serverlibrary.py, clientlibrary.py
  • application.py: Contains Flask application setup. Note the differences from previous mini-projects.
  • __init__.py: Contains database (db) object creation and imports routes.py.
  • routes.py: Defines URL routing for the app, particularly the / route.
  • users.html: Displays user data in a table format. Jinja templating used for dynamic content.

Exercise 1: Displaying User Data

  • Objective: Display user data within the users.html table.
  • Tools: Jinja templating.
  • Implementation: Replace placeholders (#Replace Me#) in users.html to iterate over users and display relevant details.
  • Dependencies: Complete Exercise Q1 in mp2_exercises.ipynb and incorporate merged sort into serverlibrary.py.

Exercise 2: Server Library Implementation

  • Objective: Implement classes in serverlibrary.py.
  • Classes: Stack, EvaluateExpression.
  • Testing:
    • Test functions in serverlibrary.py using example inputs (as provided).
    • Verify correct output is displayed and table functionality is correct.

Client Javascript Library

  • Compilation: Compile clientlibrary.py (located in app/static/) using Transcrypt.
    • Navigate to app/static/ in your terminal
    • Run transcrypt clientlibrary.py
  • Database Setup: Create the app.db database file and any required migrations.

Application Deployment and Running

  • Database Preparation: (Commands provided).
  • Flask Run:
    • Navigate to the root directory.
    • Run Flask: (Commands provided)
  • Browser Access: Open http://127.0.0.1:5000/ in your web browser to view the app.
  • Stopping the App: Press Ctrl+C to stop the Flask server.
  • Vocareum Specifics (if applicable): Follow additional instructions specific for Vocareum if needed.

Mini Project Outcomes

  • Expected output: Output examples, including sorted user data (users.html) and calculations (EvaluateExpression) are given.
  • Error Handling: Handle any errors appropriately in your serverlibrary.py and application.py files.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

This project focuses on developing a web application aimed at conducting integer arithmetic quizzes. It requires the use of Git for setup and involves various Python files to establish the application framework using Flask.

More Like This

Test Your Knowledge
35 questions
Web vs. Mobile App Development
10 questions
Web App Development Examples Quiz
5 questions
Event Handling in Web Viewer Apps
8 questions
Use Quizgecko on...
Browser
Browser