backend

Command and Control System

Installation

Setup a virtualenv and install requirements (this example uses virtualenvwrapper):

mkvirtualenv neubit_complete -p python3.11
pip install -r dev-requirements.txt

Set up database

Create a database named neubit_complete.

createdb neubit_complete

Create database migrations:

./manage.py makemigrations

Create database tables:

./manage.py migrate

Running server

./manage.py runserver

Building front-end

To build JavaScript and CSS files, first install npm packages:

npm install

Then build (and watch for changes locally):

npm run dev-watch

Running Celery

Celery can be used to run background tasks.

Celery requires Redis as a message broker, so make sure it is installed and running.

You can run it using:

celery -A neubit_complete worker -l INFO

Or with celery beat (for scheduled tasks):

celery -A neubit_complete worker -l INFO -B

Installing Git commit hooks

To install the Git commit hooks run the following:

$ pre-commit install --install-hooks

Once these are installed they will be run on every commit.

For more information see the docs.

Running Tests

To run tests:

./manage.py test

Or to test a specific app/module:

./manage.py test apps.utils.tests.test_slugs

On Linux-based systems you can watch for changes using the following:

find . -name '*.py' | entr python ./manage.py test apps.utils.tests.test_slugs