3.0 KiB
How to Contribute
We welcome pull requests from everyone. We do expect everyone to adhere to the Mozilla Community Participation Guidelines.
Setup
This application is composed of two parts: a Django backend (mentoring/
) and a React frontend (frontend/
).
Frontend
To set up the frontend for development, you will need the latest LTS Node installed.
With that, ensure you have yarn installed.
Then, in the frontend
directory, run
yarn install
to install the dependencies.
If you are working on a component (something in frontend/src/components
), then you can use the storybook view to focus on only that component:
yarn storybook
To build the full frontend and prepare it for use in a browser (if you're working on views, or on the backend), run
yarn dev
If you are planning to change the backend, this is all you need to do in the frontend/
directory.
You may need to repeat the last step (yarn dev
) if you update your working copy to include changes made by others to the frontend.
If you are making changes on the frontend, you can automatically rebuild every time a file changes with
yarn dev --watch
To run the tests,
yarn test
To actually load the frontend in the browser, you'll need to run the backend server, as described in the next section.
Backend
The backend is a normal Django app, so those familiar with Django should have no difficulty setting it up. Those unfamiliar can find some background information here.
You will need Python installed, at least version 3.6. Set up a virtualenv, and install the required packages:
python3 -mvenv sandbox
sandbox/bin/pip install -r requirements.txt
The backend defaults to a development configuration, with a local database and local users. You'll need to set up that database and create a user.
sandbox/bin/python3 manage.py migrate
sandbox/bin/python3 manage.py createsuperuser
Username: yourname
Email address: (any email address)
Password:
Password (again):
Superuser created successfully.
Finally, run the server:
sandbox/bin/python3 manage.py runserver
The result will show a message like
Starting development server at http://127.0.0.1:8000/
and you can access the server at that URL.
Sign in as the new superuser you have created.
From there, you can create a new non-superuser via the Django admin page, if you would like.
The admin page is available at /admin
, which must be entered manually.
To run the backend tests,
sandbox/bin/python3 manage.py test
When you return to the project on another day, you need only invoke the runserver
command.
As you update your working copy to include database changes made by others, you may need to run the migrate
command again as well.