Development Setup with nox¶
Note: nox is the older way of setting up development environment. This section is stale. If you find nox helpful consider updating this section
Initial Setup¶
Junction’s development workflow is automated using nox. Thus, you need
the nox
command to be installed on your system. We recommend using pipx
to install nox
in its own isolated environment.
$ python -m pip install pipx
$ pipx install nox
You will need to have a working Redis server on your system. You may additionally want to install Postgres, although it is optional.
Note
On Debian based systems, these can be installed using:
$ sudo apt install redis-server postgres
Backend¶
Create a “settings” file for local development with Django.
$ cp settings/dev.py.sample settings/dev.py
Create the database structure and populate it with sample data.
$ nox -- migrate --noinput
$ nox -- sample_data
Admin Access¶
When sample data is generated with nox -- sample_data
, a superuser is
created with the username admin
and password 123123
.
Frontend¶
Working on Junction’s frontend requires NodeJS and yarn to be installed on your system. The frontend is built using grunt. To setup the working environment, run the following:
$ cd junction/static
$ yarn install
Development workflow¶
Frontend Autobuilding¶
Junction has a Grunt configuration that is useful when working on the frontend. The following command starts a build watcher which rebuilds the frontend on every file change.
$ grunt
For ease of development app.css
is checked in to the source code. It is not
recommended to directly make changes to app.css
, rather update the less files
and run grunt
, then commit app.css
Invoking manage.py
¶
Junction’s nox
configuration is set up to invoke manage.py when no other
session (i.e. -s ...
) is specified. This also automatically sets up an
isolated environment that contains the dependencies of Junction.
$ nox # equivalent to 'python manage.py'
$ nox -- runserver # equivalent to 'python manage.py runserver'
$ nox -- migrate # equivalent to 'python manage.py migrate'
Running tests¶
For running the tests, run:
$ nox -s test
Running linters¶
For running the linters, run:
$ nox -s lint
Building documentation¶
For building the documentation, run:
$ nox -s docs