This section describes how to set up a local development environment for the You are HERO project. Since python is a platform independent language, it should be possible on most operating systems. However, the focus of this document is on Unix based systems like MacOS or Ubuntu/linux.
First of all you need python 2.7 and the version control system git. On most Unix based systems python is already installed, but you’ll need the python-dev package to compile pillow later. For the same reason you will need libjpeg-dev.
Further you need virtualenv to create a isolated python environment, which we use for handling all other requirements.
You may use your operating system’s package manager:
$ sudo apt-get install git python-dev python-virtualenv libjpeg-dev
or use easy_install:
$ easy_install virtualenv
or on MacOS:
coming soon...
$ git clone https://github.com/youarehero/youarehero.git
After cloning the git repository, browse to your project dir and run:
$ make bootstrap-dev
The script creates a virtual environment (in env/) and creates the static/, media/ and coverage/ folders, which are not in the git repo, as they contain generated data. It also creates a local settings file (src/youarehero/settings/local.py) which contains the development settings. At last it installs all required django apps and python packages inside the virtual env.
Attention
if the script breaks with an error while installing the requirements, follow the instructions for installing requirements manually in the next section.
The most requirements are installed in a isolated python environment, called virtualenv. This happened in the last paragraph.
From now on you need to activate your virtual environment:
$ source env/bin/activate
(env)$
Note
All commands starting with (env)$ are assumed to run within your virtual env.
If the script breaks or you pull the git repo later with modified requirements, you may want to install them manually.
Make sure the above dependencies (especially python-dev and libjpeg-dev) are installed on your system. To install the requirements type:
(env)$ pip install -r deploy/requirements.txt
For developing purposes the default Database engine is sqlite, so you don’t have to set up a custom database. Run:
(env)$ src/manage.py syncdb
(env)$ src/managy.py migrate
for initializing the local database. If you were asked to create a superuser, do so and continue. You will need this user to log into the django-admin and it is also your first hero.
Now you are ready to test your installation:
(env)$ src/manage.py runserver
Try to visit localhost on port 8000. If everything is working correctly you should see your local You are HERO instance.
If you want to send emails from your local machine, edit youarehero/settings/local.py:
EMAIL_HOST =
EMAIL_HOST_USER =
EMAIL_USE_TLS = True
EMAIL_PORT = 25
EMAIL_HOST_PASSWORD =
DEFAULT_FROM_EMAIL =
and insert an smtp-server, user and password, such as for an email-client.