Developer Setup¶
The following describes how to set up an instance of the site on your computer for development.
Prerequisites¶
This guide assumes you have already installed and set up the following:
- Git
- Python 3.5, pip 8 or higher, and virtualenv
- Node.js and npm.
- Postgres 9.4
openssl
These docs assume a Unix-like operating system, although the site should, in theory, run on Windows as well. All the example commands given below are intended to be run in a terminal.
Installation¶
Clone this repository or your fork:
git clone https://github.com/mozilla/morgoth.git cd morgoth
Create a virtualenv for Morgoth and activate it:
virtualenv venv source ./venv/bin/activate
Note
Whenever you want to work on Morgoth in a new terminal you’ll have to re-activate the virtualenv. Read the virtualenv documentation to learn more about how virtualenv works.
Install the dependencies using pip:
pip install -r requirements.txt
See also
- pip-install-error
How to troubleshoot errors during
pip install
.
Install frontend dependencies and build the frontend code using npm:
npm install npm run build
Create a Postgres database for Morgoth. By default it is assumed to be named
morgoth
:createdb morgoth
Note
If you use a different name for the database, or otherwise want to customize how you connect to the database, you may specify the database URL by adding the following to a
.env
file at the root of the repo:DATABASE_URL=postgres://username:password@server_addr/database_name
Initialize your database by running the migrations:
python manage.py migrate
Create a new superuser account:
python manage.py createsuperuser
Once you’ve finished these steps, you should be able to start the site by running:
./bin/runsslserver.sh
Note
The runsslserver.sh
command automatically creates a self-signed
certificate in the etc/ssl
directory of the repository. When viewing the
site for the first time, you will have to create a certificate exception to
allow Firefox to accept the certificate and access the site over HTTPS.
The site should be available at https://localhost:8000/.