https://github.com/scope-forensics/scope.git
The easiest way to get Scope up and running is by using Docker. Follow these steps:
Install Docker and Docker Compose on your machine.
Run the following command to initialize the environment:
make init
This command will set up a database, web worker, Celery worker, and Redis broker, and it will run your migrations.
Once the setup is complete, you can access your local installation of Scope at http://localhost:8000.
Note: If you encounter an error, ensure that you have a .env
file in your project directory. You can create one based on the provided .env.example
.
You can run make
to see other helper functions available in the Makefile. This file also allows you to execute specific commands directly.
For example, to run management commands in containers, you can use:
docker compose exec web python manage.py createsuperuser
Or adjust the makefile and you can run:
make superuser
If you prefer to install Scope directly on your operating system, follow these instructions:
Set up a virtual environment (this example uses virtualenvwrapper
):
mkvirtualenv scope -p python3.11
Install the required packages:
pip install -r dev-requirements.txt
Set up the database (if you’re using Docker, you can skip these steps):
Create a database named scope
:
createdb scope
Create database migrations:
python manage.py makemigrations
Create the database tables:
python manage.py migrate
Using Docker:
make start
Native:
python manage.py runserver
To build JavaScript and CSS files, first install the npm packages:
Using Docker:
make npm-install
Native:
npm install
Then, build and watch for changes locally:
Using Docker:
make npm-watch
Native:
npm run dev-watch
Celery is used to handle background tasks and manage large data operations while working with Scope. If you’re using Docker, it will start automatically.
If you’re not using Docker, you can run Celery with:
celery -A scope worker -l INFO --pool=solo
For scheduled tasks, use:
celery -A scope worker -l INFO -B --pool=solo
Note: Using the solo pool is recommended for development but not for production.
To install Git commit hooks, run the following command:
pre-commit install --install-hooks
Once installed, these hooks will run on every commit.
To run tests, use the following commands:
Using Docker:
make test
Native:
python manage.py test
To test a specific app/module:
Using Docker:
make test ARGS='apps.utils.tests.test_slugs --keepdb'
Native:
python manage.py test apps.utils.tests.test_slugs
On Linux-based systems, you can watch for changes using:
Using Docker:
find . -name '*.py' | entr docker compose exec web python manage.py test apps.utils.tests.test_slugs
Native:
find . -name '*.py' | entr python manage.py test apps.utils.tests.test_slugs