Get the code

Here’s how you can get the Raspberry IO site running on your computer.

Install Dependencies

Raspberry IO is a Django project built on top of the Mezzanine CMS, using PostgreSQL as our database. To get started, you will need the following programs installed. These should be installed using your operating system’s standard package management system:

Clone the repository

Clone the Raspberry IO repository from Github:

$ git clone git@github.com:python/raspberryio.git
Cloning into 'raspberryio'...
remote: Counting objects: 3860, done.
remote: Compressing objects: 100% (1749/1749), done.
remote: Total 3860 (delta 2081), reused 3845 (delta 2069)
Receiving objects: 100% (3860/3860), 2.98 MiB | 861.00 KiB/s, done.
Resolving deltas: 100% (2081/2081), done.

You’ll now have a new raspberryio subdirectory containing the code.

Set up your environment

Change into the raspberryio directory:

$ cd raspberryio
$

Create a virtual environment to work in and activate it:

$ mkvirtualenv --distribute raspberryio
...
$ pip install -r requirements/dev.txt
...
$

Create a local settings file and set your DJANGO_SETTINGS_MODULE to use it:

$ cp raspberryio/settings/local.example.py raspberryio/settings/local.py
$ echo "export DJANGO_SETTINGS_MODULE=raspberryio.settings.local" >> $VIRTUAL_ENV/bin/postactivate
$ echo "unset DJANGO_SETTINGS_MODULE" >> $VIRTUAL_ENV/bin/postdeactivate
$

Add the project directory to the virtualenv, deactivate and reactivate it to set up the environment variables above:

$ add2virtualenv .
$ deactivate
$ workon raspberryio
$

Set up the database

Create the Postgres database.

$ createdb -E UTF-8 raspberryio

Run the initial syncdb/migrate. When asked to create a superuser, answer no.

$ django-admin.py syncdb
$ django-admin.py migrate

Warning

Creating a superuser in the syncdb step will trigger the error django.db.utils.DatabaseError: relation "userprofile_profile" does not exist because of a required one-to-one relation with a user profile model that doesn’t exist in the database yet.

Now, create a superuser (This will also create the profile correctly):

$ django-admin.py createsuperuser

Master versus Develop branch

The master branch in the Raspberry IO repository represents the code that is running on the production site, raspberry.io. The staging server runs off the code on the develop branch. Most work should be done on feature branches off develop and then migrated to the master branch by the project maintainers, once it has been shown to be stable. We generally use the git flow model of development.

$ git checkout develop
Branch develop set up to track remote branch develop from origin.
Switched to a new branch 'develop'
$

Run the tests and server

Verify that everything is okay by running Raspberry IO’s tests.

$ django-admin.py test
[lots of output omitted]
Ran 158 tests in 62.170s

OK
[lots of output omitted]
$

Then run the development server and play around!

$ django-admin.py runserver

Project Versions

Table Of Contents

Previous topic

Welcome to Raspberry IO’s documentation!

Next topic

Submit a pull request

This Page