Setting up a Development Environment

As for production environments, Python 2.6 or 2.7 is required to run sandglass. Also, using virtualenv (and virtualenvwrapper, of course) is recommended to create an isolated environment.

Since the code is managed in a Mercurial repository, of course you’ll need a working installation of that.

Instructions on how to install these tools can be found in their respective documentation.

To install sandglass for development, follow these steps:

  1. Make sure you have the global dependencies installed. Namely, these are:

    You’ll find installation instructions on the respective websites.

  2. Create a virtualenv (be sure to use distribute instead of setuptools):

    $ mkvirtualenv -p /usr/bin/python2.7 --no-site-packages --distribute \
       sandglass
    
  3. Check out sandglass sourcecode from bitbucket:

    $ cd path/to/your/projects/
    $ hg clone ssh://hg@bitbucket.org/fabianbuechler/sandglass sandglass
    $ cd sandglass
    
  4. Activate the virtualenv and install sandglass development egg:

    $ workon sandglass
    (sandglass)$ python setup.py develop
    

    This installs sandglass from the code in the current directory. It also gives you the sandglass command.

  5. Install development-specific dependencies using pip:

    (sandglass)$ pip install -r requirements.txt
    

    This installs stuff like Sphinx for building documentation or pep8 for checking code syntax, but also little helpers like IPython or the django-debug-toolbar.

  6. Create a installation using the sandglass init command:

    (sandglass)$ cd ..
    (sandglass)$ sandglass init --template=develop sandglass-dev
    (sandglass)$ cd sandglass-dev
    

    The sandglass init command uses the deploy template “develop” to create a directory with all files required to run sandglass for you.

  7. Adapt basic settings.py to fit your needs.

    For information about that check Django’s documentation on settings.

    Make sure to set the correct path to your yuicompressor binary. Default is:

    PIPELINE_YUI_BINARY = '/usr/local/bin/yuicompressor'
    

    But for Ubuntu, it might be:

    PIPELINE_YUI_BINARY = '/usr/bin/yui-compressor'
    
  8. Initialize your database:

    (sandglass)$ python manage.py syncdb
    # follow the instructions
    (sandglass)$ python manage.py migrate --all
    
  9. Start sandglass development server:

    Sandglass is using Django’s runserver for development, either use:

    (sandglass)$ python manage.py runserver
    

    or

    (sandglass)$ sandglass serve
    

    to start it. Then open your browser at http://localhost:8000/ to check if everything is working correctly.

Project Versions

Previous topic

Contributing

Next topic

Sandglass Development Documentation

This Page