-
Notifications
You must be signed in to change notification settings - Fork 64
Setting up the development environment on Ubuntu
Please note that your system most be updated before following these instructions. These instructions have been adapted from the README.rst.
You will need to configure git and upload your SSH keys to github
You need a few libraries and can grab them with this command:
sudo apt-get install git-core sudo apt-get install libxml2-dev sudo apt-get install libxslt-dev sudo apt-get install mysql-client sudo apt-get install mysql-server sudo apt-get install libmysqlclient-dev sudo apt-get install python-dev sudo apt-get install python-setuptools
To obtain the lernanta's source code that you will be modifying, first fork the repository on the github website and then clone it by running:
git clone [email protected]:<your github username>/lernanta.git
Next, you'll need to install virtualenv
and pip
if you don't already have them. Using virtualenvwrapper is also recommended.
sudo easy_install virtualenv sudo easy_install pip sudo pip install virtualenvwrapper
Be sure to configure your shell so that pip knows where to find your virtual environments:
# in .bashrc or .bash_profile export WORKON_HOME=$HOME/.virtualenvs export PIP_VIRTUALENV_BASE=$WORKON_HOME export PIP_RESPECT_VIRTUALENV=true source /usr/local/bin/virtualenvwrapper.sh
Once installed, create your virtual environment for lernanta
and install the dependencies. There's a chance that packages listed in requirements/compiled.txt
won't install cleanly if your system is missing some key development libraries. For example, lxml requires libxml2-dev
and libxslt-dev
. These should be available from your system's package manager.
cd lernanta mkvirtualenv --no-site-packages lernanta workon lernanta pip install -r requirements/compiled.txt pip install -r requirements/prod.txt pip install -r requirements/dev.txt
To be extra sure you're working from a clean slate, you might find it helps to delete .pyc
files:
./sh/rmpyc
If the mysql database doesn't exist yet, create it. To do this, run the mysql command line:
mysql -u root -p
Create the database 'lernanta' and a user to access it (we'll use 'lernantauser', with the password 'lernantapass'):
create database lernanta; grant usage on *.* to lernantauser@localhost identified by 'lernantapass'; grant all privileges on lernanta.* to lernantauser@localhost;
To run tests, you'll also need to create a test database:
create database test_lernanta; grant all privileges on test_lernanta.* to lernantauser@localhost;
To test that you can login with your mysql user, quit mysql and from the terminal command line run:
mysql -u lernantauser -p lernanta
Create a settings_local.py
based on the template provided in the checkout. Edit the database parameters as needed
cp settings_local.dist.py settings_local.py
If you not installed a local version of mysql, you will need to do so now.
Next, sync the database and run migrations.
./sh/syncdb
Finally, start the development server to take it for a spin. You can register a new account and look in the terminal window where the server is running to find the activation link (If you get 404 error for that url, remove the "=": http://www.flickr.com/photos/digifoo/5593967846/).
python manage.py runserver
To run tests:
# The first time FORCE_DB=1 python manage.py test # After the first time python manage.py test
Once you have your development environment running, you can make changes or get the latest from github. See the wiki for more information: https://github.com/p2pu/lernanta/wiki