Before you start hacking on summit, you need to first setup your environment. We’re going to set it up without breaking anything else in your current.
virtualenv is a tool to create isolated Python environments. We don’t want to install packages system-wide because that can create quite a mess. The following command will install the required development files on Ubuntu or, if you’re running a recent version, you can install them automatically:
sudo apt-get install python-virtualenv
virtualenv is the only Python package you need to install system-wide. Everything else goes in a virtual environment.
virtualenvwrapper is a set of shell functions that make virtualenv easy to work with.
For Ubuntu Maverick Meerkat and above, install virtualenvwrapper via apt:
sudo apt-get install virtualenvwrapper
Once installed, exec bash and you’re set to start!
For earlier releases, install it like this:
wget http://bitbucket.org/dhellmann/virtualenvwrapper/raw/f31869779141/virtualenvwrapper_bashrc -O ~/.virtualenvwrapper
mkdir ~/.virtualenvs
Then put these lines in your ~/.bashrc:
export WORKON_HOME=$HOME/.virtualenvs
source $HOME/.virtualenvwrapper
exec bash and you’re set.
Note
If you didn’t have a .bashrc already, you should make a ~/.profile too:
echo 'source $HOME/.bashrc' >> ~/.profile
Create the bzr environment for summit with:
bzr init-repo summit
cd summit
bzr branch lp:summit trunk
bzr branch trunk myfeaturex
cd myfeaturex
From now on, you can simply cd trunk && bzr pull when you want to update your trunk.
Now we’re ready to go, so create an environment for summit:
mkvirtualenv --no-site-packages summit
That creates a clean environment named summit. You can get out of the environment by restarting your shell or calling deactivate.
To get back into the summit environment later, type:
workon summit # requires virtualenvwrapper
Note
If you want to use a different Python binary, pass the path to mkvirtualenv with --python:
mkvirtualenv --python=/usr/bin/python2.6 --no-site-packages summit
From inside your activated virtualenv, run:
pip install -r requirements.txt
pip installs all the dependencies with the exact revisions as our production environment.
Most of summit is already configured in ubuntu_settings.py, linaro_settings.py and settings.py, but there’s some things you need to configure locally. All your local settings go into local_settings.py. Just copy local_settings.py.sample to create local_settings.py and everything should run fine.
Get setup for the themes for Ubuntu and Linaro:
./manage.py init-summit
./manage.py pullapps
Let Django sync up the database schema for you and run the migrations:
./manage.py syncdb
./manage.py migrate
If you’ve gotten the system requirements, downloaded the source code, set up your virtualenv, and configured your settings and database, you’re good to go. Summit is now split into two different ‘sites,’ Ubuntu and Linaro. You will need to call the proper settings for the site you wish to run. To run the server:
python manage.py runserver --settings ubuntu_settings
python maange.py runserver --settings linaro_settings
Come talk to us on irc://irc.freenode.net/#ubuntu-website if you have questions, issues, or compliments.
The quick way to run summit’s tests:
./manage.py test
Make sure to write tests for all new code your write and all the tests pass.