Development

Requirements

Install Locally

  1. Clone and change to the directory:

    git clone git@github.com:mozilla-services/push-dev-dashboard.git
    cd push-dev-dashboard
    
  2. Create and activate a virtual environment (Can also use virtualenvwrapper):

    virtualenv env
    source env/bin/activate
    
  3. Install requirements:

    pip install -r requirements-dev.txt
    npm install
    npm link stylus yuglify
    
  4. Copy the .env-dist file to .env:

    cp .env-dist .env
    
  5. Source the .env file to set environment config vars (Can also use autoenv):

    source .env
    
  6. `Migrate`_ DB tables

    python manage.py migrate
    
  7. Create a superuser:

    python manage.py createsuperuser
    

Run it

  1. Source the .env file to set environment config vars (Can also use autoenv):

    source .env
    
  2. Activate the virtual environment (Can also use virtualenvwrapper):

    source env/bin/activate
    
  3. Run it:

    python manage.py runserver
    

Enable Firefox Accounts Auth

To enable Firefox Accounts authentication, you can use our local development OAuth client app.

  1. Add a django-allauth social app for Firefox Accounts (Log in as the superuser account you created):
    • Provider: Firefox Accounts
    • Name: fxa
    • Client id: 7a4cd4ca0fb1b5c9
    • Secret key: c10059ba24e6715a1b6f2c80f1cc398fb6a39ca18bc7554e894b36ea85b88eeb
    • Sites: example.com -> Chosen sites
  2. Log out of the admin account
  3. Sign in with a Firefox Account at http://127.0.0.1:8000.

Run in production mode

Follow these steps to emulate production (for example, to test compressed assets). Run all commands from the project root.

  1. Stop runserver if it’s already running
  2. In .env, set DJANGO_DEBUG to False
  3. Run python manage.py collectstatic
  4. Install stunnel
    • Mac: brew install stunnel
  5. Run this command to generate a local cert and key for stunnel (you can use the default values for all prompts): openssl req -new -x509 -days 9999 -nodes -out stunnel/stunnel.pem -keyout stunnel/stunnel.pem
  6. Run stunnel stunnel/dev_https
  7. In another terminal, run HTTPS=1 python manage.py runserver 127.0.0.1:5000
  8. Go to https://127.0.0.1:8443 to confirm the certificate exception and browse the site

Working on Docs

Install doc requirements:

pip install -r requirements-docs.txt

Building the docs is easy:

cd docs
sphinx-build . html

Read the beautiful docs:

open html/index.html

Updating Translations

  1. Run makemessages to make updated django.po files:

    python manage.py makemessages --keep-pot
    
  2. Commit the updates to git:

    git add locale
    git commit -m "Updating translations {YYYY-MM-DD}"
    

Adding a Translation

  1. First, Update translations

  2. Make the new {locale} directory for the new language:

    mkdir locale/{locale}
    
  3. Run makemessages to make the django.po file for it:

    python manage.py makemessages -l {locale}
    
  4. Add the new directory to git:

    git add locale/{locale}
    git commit -m "Adding {locale} locale"
    

What to work on

We have Issues.