Skip to content

fecgov/fecfile-web-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About this project

The Federal Election Commission (FEC) is the independent regulatory agency charged with administering and enforcing the federal campaign finance law. The FEC has jurisdiction over the financing of campaigns for the U.S. House, Senate, Presidency and the Vice Presidency.

This project will provide a web application for filling out FEC campaign finance information. The project code is distributed across these repositories:


Set up

Prerequisites

Software necessary to run the application locally:

Environment variables

You will need to define a DJANGO_SECRET_KEY. Locally you can just add something like this your rc file: export DJANGO_SECRET_KEY="thisismykey"

By default EFO services (print/upload) will be mocked. To integrate with EFO, set the following environment variables:

# Test EFO Services (for test filings):
export MOCK_EFO_FILING=False
export EFO_FILING_API_KEY="EFO_get_this_from_team_member"

Note - the default PRODUCTION_OPEN_FEC_API_KEY and STAGE_OPEN_FEC_API_KEY key has a very low rate limit - for a better key, reach out to a team member or get one at https://api.open.fec.gov/developers/

Docker basic usage

When running docker compose you will need to be in the root directory of the project. The reason for this is that docker compose looks for docker-compose.yml to be in the same directory where it's run. You will also need at least 3GB of memory allocated for docker during the build.

Spin up the containers

docker compose up -d

Shut down the containers

docker compose down

See all running containers

docker ps

Running commands in a running container

docker exec <container name> <command>

Rebuilding containers

docker compose build [<container name>] [--no-cache]

Local testing

Running unit tests locally

Drop into the API container with:

docker exec -it fecfile-api bash -H

You can then run unit tests with:

python3 manage.py test [-k <test name>]

Monitoring containers

docker stats

Viewing logs

View logs for a single container:

docker logs <container ID> [-f]

View logs for all containers:

docker compose logs [-f]

To view only the error logs:

docker logs <container ID> [-f] 1>/dev/null

To view only the access logs:

docker logs <container-id> [-f] 2>/dev/null

The -f (follow) flag causes the command to continue to output log messages as they occur until the user issues a break.

Deployment (FEC team only)

Deployment instructions

See also: Technical Design

Additional developer notes

Once the web API application is running, you may go to http://localhost:8080/ to see the API documentation.

See Additional Developer Notes.

About

Back-end API for FECfile application

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 34

Languages