manage.get.gov/docs/developer
Seamus Johnston 196e4b8fd6
Write Django cmd for running lint (#100)
* Write Django cmd for running lint

* Respond to PR feedback
2022-09-02 13:42:40 -05:00
..
README.md Write Django cmd for running lint (#100) 2022-09-02 13:42:40 -05:00

Development

========================

If you're new to Django, see Getting Started with Django for an introduction to the framework.

Local Setup

  • Install Docker https://docs.docker.com/get-docker/

  • Initialize the application:

    cd src
    docker-compose build
    
  • Run the server: docker-compose up

    Press Ctrl-c when you'd like to exit or pass -d to run in detached mode.

Visit the running application at http://localhost:8080.

Setting Vars

Every environment variable for local development is set in src/docker-compose.yml.

Including variables which would be secrets and set via a different mechanism elsewhere.

Viewing Logs

If you run via docker-compose up, you'll see the logs in your terminal.

If you run via docker-compose up -d, you can get logs with docker-compose logs -f.

You can change the logging verbosity, if needed. Do a web search for "django log level".

Running tests

Crash course on Docker's run vs exec: in order to run the tests inside of a container, a container must be running. If you already have a container running, you can use exec. If you do not, you can use run, which will attempt to start one.

To get a container running:

cd src
docker-compose build
docker-compose up -d

Django's test suite:

docker-compose exec app ./manage.py test

Linters:

docker-compose exec app ./manage.py lint