Install

This app is designed to be run using pip + virtualenv + virtualenvwrapper. Tested with python 2.7.3.

To get up and running:

  1. Install pip (if it is not already there)

    $ sudo apt-get install python-pip
    
  2. Install some dependencies (if they are not already installed)

    $ sudo apt-get install gcc libxslt1-dev python-dev
    
  3. Install virtualenv and virtualenvwrapper

    $ pip install virtualenv virtualenvwrapper
    
  4. Add some environment variables to your shell startup script, such as .bashrc. This allows pip and virtualenv and virtualenvwrapper to do their magic. The exact location of the virtualenvwrapper.sh script might be different on your system.

    export WORKON_HOME=$HOME/Envs
    source /usr/local/bin/virtualenvwrapper.sh
    
  5. Create and configure the virtualenv, and add source code.

    mkdir -p $WORKON_HOME
    mkvirtualenv storage-service
    git clone git@github.com:artefactual/archivematica-storage-service.git
    cd archivematica-storage-service
    setvirtualenvproject
    

    You should now have a virtualenv, with it’s own isolated python interpreter, and a project directory. The source code for the project should be there ready to work with.

  6. Add dependencies. Assuming you are doing development work, use the local requirements file. For a testing or production install, use requirements/testing.txt or requirements/production.txt, respectively.

    pip install -r requirements/local.txt
    
  7. Create required environment variables. Add the following to your virtualenv’s postactivate script, found in this example at $WORKON_HOME/storage-service/bin/postactivate. Set the DJANGO_SETTINGS_MODULE to match whichever requirements file you installed from (local, test or production).

    PROJECTPATH=$(cat $VIRTUAL_ENV/.project)
    export PYTHONPATH=$PYTHONPATH:$PROJECTPATH
    
    export DJANGO_SETTINGS_MODULE=storage_service.settings.local
    export DJANGO_SECRET_KEY='ADDKEY'
    export SS_DB_NAME='storage_service/default.db'
    export SS_DB_USER=''
    export SS_DB_PASSWORD=''
    export SS_DB_HOST=''
    
  8. Create the database schema. You can use the django-admin script to make an initial version of the main database, then use the tool South to create the fpr app’s data model.

    cdproject
    cd storage_service
    python2 manage.py syncdb
    python2 manage.py migrate
    
  9. Start the server. This example uses Django’s built in webserver, good for testing only. Use a WSGI compliant webserver like Apache or Nginx in production. Using 0.0.0.0 makes the app available on all interfaces.

    cdproject
    cd storage_service
    python2 manage.py runserver 0.0.0.0:8000
    

Back to the top