GithubHelp home page GithubHelp logo

irisliu6666 / 2021compsci235-03-covidwebapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uoa-cs-urschler-teaching-cs235-s1-2021/2021compsci235-03-covidwebapp

1.0 0.0 0.0 121 KB

Shell 0.56% Python 80.04% CSS 4.45% HTML 14.96%

2021compsci235-03-covidwebapp's Introduction

CompSci 235 S2 2021: Sample COVID-19 Web Application

Description

A Web application that demonstrates use of Python's Flask framework. The application makes use of libraries such as the Jinja templating library and WTForms. Architectural design patterns and principles including Repository, Dependency Inversion and Single Responsibility have been used to design the application. The application uses Flask Blueprints to maintain a separation of concerns between application functions. Testing includes unit and end-to-end testing using the pytest tool.

Installation

Installation via requirements.txt

$ cd 2021CompSci235-03-CovidWebApp
$ py -3 -m venv venv
$ venv\Scripts\activate
$ pip install -r requirements.txt

When using PyCharm, set the virtual environment using 'File'->'Settings' and select 'Project:2021CompSci235-03-CovidWebApp' from the left menu. Select 'Project Interpreter', click on the gearwheel button and select 'Add'. Click the 'Existing environment' radio button to select the virtual environment.

Execution

Running the application

From the 2021CompSci235-03-CovidWebApp directory, and within the activated virtual environment (see venv\Scripts\activate above):

$ flask run

Configuration

The 2021CompSci235-03-CovidWebApp/.env file contains variable settings. They are set with appropriate values.

  • FLASK_APP: Entry point of the application (should always be wsgi.py).
  • FLASK_ENV: The environment in which to run the application (either development or production).
  • SECRET_KEY: Secret key used to encrypt session data.
  • TESTING: Set to False for running the application. Overridden and set to True automatically when testing the application.
  • WTF_CSRF_SECRET_KEY: Secret key used by the WTForm library.

Testing

After you have configured pytest as the testing tool for PyCharm (File - Settings - Tools - Python Integrated Tools - Testing), you can then run tests from within PyCharm by right clicking the tests folder and selecting "Run pytest in tests".

Alternatively, from a terminal in the root folder of the project, you can also call 'python -m pytest tests' to run all the tests. PyCharm also provides a built-in terminal, which uses the configured virtual environment.

2021compsci235-03-covidwebapp's People

Contributors

martinurschler avatar

Stargazers

 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.