/loc-sas

Primary LanguageVue

LoC SAS

A web application that enables users to submit copyright applications via an online portal.

Installation

Dependencies

  • This project is built on Flask-AppBuilder and tested against Python 3.6+.
  • The frontend utilizes Vue JS; NPM is required to build and run it Install NPM

Local Development

Set up your virtual environment with all the necessary packages:

git clone git@git.loc.gov:799/DLR/reporting.git
cd loc-sas
mkvirtualenv -p /usr/local/bin/python3.7 -r requirements.txt loc-sas

If you are using PyCharm, make sure you enable code compatibility inspections for Python 3.6/3.7/3.8.

Running locally

Backend

These commands will remove any stray local Sqlite database, create some test data and test users, create an admin user, and run the Flask application.

rm -f app.db
python testdata.py
flask fab create-admin --username admin --password admin --email admin@example.org --firstname admin --lastname user
FLASK_APP=app/__init__.py FLASK_DEBUG=1 flask run

Open http://localhost:5000 and log in as user1, user2, or user3 with password password. Or login with admin/admin.

Frontend

cd client
npm install
npm run serve
  • Open http://localhost:5001, you will be automatically logged in as user1
  • The client interfaces with backend API calls.
  • A login screen will be added once OAUTH2 is configured with an authentication provider.

To build the frontend into the flask server for production:

cd ..
./build-client.sh

Testing

Backend

To run the backend test-suite along with linting:

make test-local

Frontend

To run the frontend test-suite:

cd client
npm test

SonarQube

You can run LoC's SonarQube analysis locally against your current feature branch.

Download the sonar scanner for your development environment OS.

Set up this environment variable based on where you installed the scanner:

export SONAR_SCANNER=/Users/loren/Downloads/sonar-scanner-4.2.0.1873-macosx/bin/sonar-scanner

Ensure your LoC VPN is enabled.

Generate the test results in the Cobertura format that SonarQube requires and send the results in to the scanner:

make sonarqube

PyCharm users can integrate the SonarLint plugin and tie it into the LoC's SonarQube server to apply this project's Quality Profiles during development.

First, ensure your LoC VPN is enabled. In PyCharm, download and install the SonarQube Community Intellij Plugin and the SonarLint Plugin. You'll need to restart PyCharm afterwards.

Download Plugins

Create the SonarQube Server connection:

Connect to SonarQube Server

Configure the SonarLint plugin for PyCharm: Configure SonarLint General

Configure the SonarLint plugin for this project: Configure SonarLint Project

Here is an example of what the integration looks like in PyCharm: Example SonarLint Issue

Application Screenshots

Home Page Home Page Create Application Create Application Application Review Application Review