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 2.7, pip, and virtualenv
- Node.js and npm
- Postgres 9.4
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 --recursive https://github.com/mozilla/pontoon.git cd pontoonCreate a virtualenv for Pontoon and activate it:
virtualenv venv source ./venv/bin/activateNote
Whenever you want to work on Pontoon 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 the latest version of pip:
pip install --require-hashes -r requirements.txt
Create a
.envfile at the root of the repository to configure the settings for your development instance. It should look something like this:SECRET_KEY=insert_random_key DJANGO_DEV=True DJANGO_DEBUG=True DATABASE_URL=postgres://pontoon:asdf@localhost/pontoon SESSION_COOKIE_SECURE=False HMAC_KEY=insert_random_key SITE_URL=http://localhost:8000
Make sure to make the following modifications to the template above:
SECRET_KEYandHMAC_KEYshould be set to some random key you come up with, as they are used to secure the authentication data for your local instance.DATABASE_URLshould contain the connection data for connecting to your Postgres database. It takes the formpostgres://username:password@server_addr/database_name.SITE_URLshould be set to the URL you will use to connect to your local development site. Some people prefer to usehttp://127.0.0.1:8000instead oflocalhost.
Initialize your database by running the migrations:
python manage.py migrate
Create a new superuser account:
python manage.py createsuperuser
Make sure that the email address you use for the superuser account matches the email that you will log in with via Persona.
Pull the latest strings from version control for the Pontoon Intro project (which is automatically created for you during the database migrations):
python manage.py sync_projects --no-commit pontoon-intro
Install the required Node libraries using
npm:npm install
Once you’ve finished these steps, you should be able to start the site by running:
python manage.py runserver
The site should be available at http://localhost:8000.
Extra settings¶
The following extra settings can be added to your .env file.
MICROSOFT_TRANSLATOR_API_KEY- Set your Microsoft Translator API key to use machine translation.
GOOGLE_ANALYTICS_KEY- Set your Google Analytics key to use Google Analytics.
MOZILLIANS_API_KEY- Set your Mozillians API key to grant permission to Mozilla localizers.