Skip to content

Instantly share code, notes, and snippets.

@rfreebern
Created June 23, 2012 17:27
Show Gist options
  • Save rfreebern/2979120 to your computer and use it in GitHub Desktop.
Save rfreebern/2979120 to your computer and use it in GitHub Desktop.
installing mozillians in a virtualenv

Repo clone:

git clone git://github.com/mozilla/mozillians.git mozillians
cd mozillians
mkvirtualenv mozillians
git submodule sync
git submodule update --init --recursive
pushd vendor
git submodule sync
git submodule update --init --recursive
popd

Local settings:

pushd settings
cp local.py-dist local.py
vim local.py

    --- settings/local.py-dist    2012-06-22  21:42:48.000000000 -0400
    +++ settings/local.py	2012-06-23 07:32:51.000000000 -0400
    @@ -4,7 +4,7 @@
     from settings import *
     
     # For absoluate urls
    -DOMAIN = "localhost"
    +DOMAIN = "127.0.0.1"
     PROTOCOL = "http://"
     PORT = 8000
     
    @@ -52,7 +52,15 @@
     ES_DISABLED = False
     ES_HOSTS = ['127.0.0.1:9200']
     ES_INDEXES = dict(default='mozillians_dev')
    +ES_TIMEOUT = 60
     
     CELERY_ALWAYS_EAGER = True
     
     JAVA_BIN = '/usr/bin/java'
    +
    +CACHES = {
    +    'default': {
    +        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    +        'LOCATION': 'unique-pastry-chef'
    +    }
    +}

The DOMAIN change is just my preference. The ES_TIMEOUT just ensures that even on my slow laptop, elasticsearch has plenty of time to respond to queries. The CACHES overrides mozillians' default memcached configuration to use a non-persistent local memory store for development.

popd

Dependencies:

pip install -r requirements/dev.txt

(Error: fatal: ambiguous argument '1.3.X': unknown revision or path not in the working tree.)

vim requirements/prod.txt

    diff --git a/requirements/prod.txt b/requirements/prod.txt
    index 96970a6..848e316 100644
    --- a/requirements/prod.txt
    +++ b/requirements/prod.txt
    @@ -1,5 +1,5 @@
     # Django stuff
    --e git://github.com/django/[email protected]#egg=django
    +-e git://github.com/django/[email protected]#egg=django

pip install -r requirements/dev.txt 
pip install py-bcrypt
pip install MySQL-python
pip install PIL
pushd ~
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.4.tar.gz
tar -xzf elasticsearch-0.19.4.tar.gz
./elasticsearch-0.19.4/bin/elasticsearch >/dev/null 2>&1
popd

Database:

echo "CREATE DATABASE mozillians;" | mysql -uroot
./manage.py syncdb

(Error: django.db.utils.DatabaseError: (1146, "Table 'mozillians.profile' doesn't exist")

./manage.py syncdb
./manage.py migrate
./manage.py update_product_details -f

User:

./manage.py runserver

Load http://127.0.0.1:8000 and sign in with BrowserID, then create your profile.

wget https://gist.github.com/raw/2977984/337032bc10d38fde75bad73cdc0f0d672197a637/su.py
vim su.py

Replace [email protected] with the email address you used to sign in.

cat su.py | ./manage.py shell
./manage.py runserver

On the site, your account will be verified, superuser, staff.

rm su.py
find . -type f -iname "*.pyc" -delete
git reset --hard HEAD

Get started with development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment