VirtualEnv Installation

Getting your own development environment.

Preparing Your System

Prerequisites: You ‘ll need python, virtualenv, pip, git and mysql-server.

  • For debian based systems:

    $ sudo apt-get install python-dev python-pip python-virtualenv git mysql-server libmysqlclient-dev \
      libxslt1.1 libxml2 libxml2-dev libxslt1-dev libffi-dev
    

For other Linux distributions, you can consult the documentation of your distribution.

Build the Environment

When you want to start contributing…

  1. Fork the main ReMo repository (https://github.com/mozilla/remo) on GitHub.

  2. Clone your fork to your local machine:

    $ git clone git@github.com:YOUR_USERNAME/remo.git remo
    (lots of output - be patient...)
    
  3. Create your python virtual environment.:

    $ cd remo/
    $ virtualenv --no-site-packages venv
    
  4. Activate your python virtual environment.:

    $ source venv/bin/activate
    
  5. Install development requirements.:

    (venv)$ python ./bin/pipstrap.py
    (venv)$ pip install --require-hashes --no-deps -r requirements/dev.txt
    

    Note

    When you activate your python virtual environment ‘venv’ (virtual environment’s root directory name) will be prepended to your PS1.

    Note

    Since you are using a virtual environment all the python packages you will install while the environment is active, will be available only within this environment. Your system’s python libraries will remain intact.

  6. Configure your local ReMo installation.:

    (venv)$ cp env-dist .env
    

    Uncomment the line for DATABASE_URL in .env to point to the localhost hostname.

  7. Setting up a MySQL database for development:

    Install the MySQL server. Many Linux distributions provide an installable package. If your OS does not, you can find downloadable install packages on the MySQL site.

  8. Start the mysql client program as the mysql root user:

    $ mysql -u root -p
    Enter password: ........
    mysql>
    
  9. Create a remo database:

    mysql> create database remo character set utf8;
    
  10. Sync DB.:

    (venv)$ ./manage.py migrate --noinput
    
  11. Create an admin account.

    Create your own admin account:

    (venv)$ ./manage.py createsuperuser
    
  12. Update product_details package.

    Package product_details provides information about countries. We use it in country selection lists. The information get pulled form mozilla’s SVN, so we need to fetch it at least once. To update run:

    (venv)$ ./manage.py update_product_details
    
  13. Collect static files.

    Various packages provide static files. We need to collect them in the STATIC_DIR:

    (venv)$ ./manage.py collectstatic
    
  14. Load demo data (optional).

    Depending on what you are going to develop you may need to have some demo data.

    To load demo users run (within your virtual env):

    (venv)$ ./manage.py loaddata demo_users
    

    To load demo functional areas run:

    (venv)$ ./manage.py loaddata demo_functional_areas
    

    To load demo mobilizing expertise run:

    (venv)$ ./manage.py loaddata demo_mobilising_skills
    

    To load demo mobilizing learning interests run:

    (venv)$ ./manage.py loaddata demo_mobilising_interests
    

    To load demo events run:

    (venv)$ ./manage.py loaddata demo_events
    

    To fetch bugzilla bugs run:

    (venv)$ ./manage.py fetch_bugs
    

    Note

    Fetching bugzilla bug requires a Mozilla Reps Admin account on Bugzilla. Ping nemo-yiannis or tasos on #remo-dev to give you access if your project requires it.

  15. Run tests:

    (venv)$ ./manage.py test