pythonph / jobs-board

PythonPH Jobs Board

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PythonPH Jobs Board

Build Status

Development

Requirements

  • Python 3.5.x
  • Node 4.x
  • PostgreSQL 9.4+

Setup

  1. Install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r reqs/development.txt
npm install
  1. Setup database
createuser -P pythonph
createdb -O pythonph jobsboard
  1. Create configuration file
cat .env
DEBUG=True
SECRET_KEY=secret
DATABASE_URL=postgres://pythonph:password@localhost/jobsboard
EMAIL_HOST_USER=<YOUR GMAIL EMAIL>
EMAIL_HOST_PASSWORD=<YOUR GMAIL PASSWORD>
  1. Run migrations
./manage.py migrate
  1. Create admin user
./manage.py createsuperuser
  1. Run development server
./manage.py runserver

Docker Development (Alternative)

If you prefer to use docker for development, follow these steps instead.

Requirements

  • Docker Engine
  • Docker Compose

Setup

  1. Create configuration file
cat .env
DEBUG=True
SECRET_KEY=secret
DATABASE_URL=postgres://pythonph:password@postgres:5432/jobsboard
EMAIL_HOST_USER=<YOUR GMAIL EMAIL>
EMAIL_HOST_PASSWORD=<YOUR GMAIL PASSWORD>
  1. Run migrations and create admin user

    docker-compose run --rm -u "$(id -u):$(id -g)" web /bin/bash
    python3 manage.py migrate
    python3 manage.py createsuperuser
    exit
  2. Run development server

    docker-compose run --rm --service-ports web

Running the tests

We use py.test as our test runner. It is currently configured to run the files inside directories named tests inside the sub-apps.

Example: the tests for the jobsboard.jobs sub-app are inside jobsboard/jobs/tests/

Basic usage:

py.test

py.test recreates the test DB every time. The time difference will become more noticeable once we have a lot of models in the app.

To get around this, we can add --reuse-db to skip the db creation step. Take note that this doesn't reuse the existing DB for the current run, but for the next one.

py.test --reuse-db

If you introduced new fields or new models and use --reuse-db when running the test, you need to add --create-db so it will recreate the DB that includes you new fields or models.

py.test --create-db

You may also combine --reuse-db and --create-db so that it will create a new DB for this run, but reuse the test DB in the succeeding runs.

py.test --create-db --reuse-db

Styleguides

License

MIT

About

PythonPH Jobs Board

License:MIT License


Languages

Language:Python 56.8%Language:HTML 42.5%Language:Shell 0.6%Language:CSS 0.0%