Skip to content

Instantly share code, notes, and snippets.

@mdornseif
Created April 26, 2010 14:04
Show Gist options
  • Save mdornseif/379369 to your computer and use it in GitHub Desktop.
Save mdornseif/379369 to your computer and use it in GitHub Desktop.

Notes on using Silverlining

silver run

For some reason silver run $(DNS) -vvvv manage.py loaddata [fixture] does not work as expected. I now I use [app_name]/fixtures/initial_data.json which gets loaded during syncdb. Not the same but works.

Somethings like this in settings.py helps finding fixtures:

OUR_ROOT = os.path.dirname(os.path.realpath(__file__))
FIXTURE_DIRS = (os.path.join(OUR_ROOT, 'fixtures'),)

silver run seems only be able to run python commands, nothing else.

Uploading Requirements

If you have Python libraries installed in a system-wide location and not with virtualenv they might not be installed on the server. Before deploying do something like

../../bin/pip install -I -r ./requirements.txt

to ensure everythong is installed. -I is the important parameter here.

Database

To get started you might want to use SQLite - less moving parts. Put something like this into your settings.py:

OUR_ROOT = os.path.dirname(os.path.realpath(__file__))
FILE_STORAGE = os.environ.get('CONFIG_FILES', OUR_ROOT)
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(FILE_STORAGE, 'www.db')

Your Database will be somewhere at ~/.silverlining-app-data/files/

Remember that mixed case in PostgreSQL is difficult. If your appname is mixed case expect issues.

settings.py mixup

If your settings.py seem to have no effect, the server may import the wrong settings.py. Try

echo "import os, sys
OUR_ROOT = os.path.dirname(os.path.realpath(__file__))
sys.path = [os.path.realpath(os.path.join(OUR_ROOT, '../../src/$PROJECT-src'))] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
" > lib/python/silvercustomize.py

where $PROJECT should be your Project name. This ensures settings.py in your project are found first.

Creating an development environment

http://github.com/hudora/hd_django_project_template/blob/master/silver-build-layout.sh is an example how to set up an development environment.

DNS

Silverlining automatically strips www of the beginning URLs. So make sure www.example.com and example.com point to the same host.

SSH key managment

silver setup-node tries to use the keys id_rsa.pub and id_dsa.pub and install the first one found on the server.

Further reading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment