Skip to content

Getting Started

Donald Dong edited this page Apr 21, 2019 · 3 revisions

Parrot uses React and Django. Before installing the libraries and dependencies, let's first make sure we have the latest tool. The provided commands in the code blocks shall work on Mac and most Linux systems.

Install Python3

Get the latest version of Python at https://www.python.org/downloads/ or with your operating system’s package manager.

Install Nodejs

We use the latest LTS Version (10.15.1 at this moment), and it comes with npm (the node package manager, version 6.4.1). Get the Installers or Binaries at https://nodejs.org/en/download/.

Now we're ready to install some packages :)

Backend packages

Create a Python Virtual Environment

In the project root, let's create a virtual environment for parrot

python3 -m venv penv

The directory penv is ignored by the Git version control system.

Activate the environment

source penv/bin/activate

We need to activate the environment before we use or update the backend packages. Command deactivate will deactivate this environment. Read more at official documentation.

Install the packages

In the activated environment, we can do

pip install -r requirements.txt

Frontend packages

To install the frontend packages, It's as simple as

npm install -C frontend

Build the frontend

npm run watch -C frontend

This command will let webpack watch files and recompile whenever they change. We should keep the watching process alive during the development.

Load fixtures

Before we start our Django server, we need to load the fixtures or the local database will be empty and there's nothing to render.

./scripts/load_fixtures.sh

Spin-up Django

python manage.py runserver

It should output

Starting development server at http://127.0.0.1:8000/

We can verify it's working by visiting this URL in the browser.

Congrats! Now you're ready to poke around and make your contribution.

Happy coding!

Note

To start developing the project (every time), we must ensure:

  • The frontend build watching processing is alive. If not, run
npm run watch -C frontend
  • The parrot virtual environment is activated. If not, run
source penv/bin/activate
  • The Django development server process is alive. If not, run
python manage.py runserver

Note this command must be run in a terminal which the parrot virtual environment is activated.

Clone this wiki locally