= Development Environment Setup = [[PageOutline(2-4,Table of Contents,inline)]] Assumes you are putting all this code in PROJECT_DIR == 1. Install a C compiler and native libraries == === On Mac === * install Xcode (from app store) * install !HomeBrew (from ruby script via !HomeBrew project homepage) * then: {{{ brew install postgresql brew install geos brew install proj brew install postgis brew install gdal brew install libgeoip }}} that's all based on the instructions at: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#macports === On Ubuntu === These instructions are pretty thorough and helpful: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/ On our staging server we followed these instructions since it is running Ubuntu 10.04: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#through-11-04 == 2. Setup database == * then ran: {{{ initdb /usr/local/var/postgres }}} * had trouble running {{{createdb}}} because Mac OSX Lion now, apparently, comes with it's own Postgres installed, and, while {{{initdb}}} and {{{pg_ctl}}} were running the !HomeBrew versions, for some reason {{{createdb}}} was defaulting to the pre-packaged Max OSX version. To fix this I simply modified my path in {{{.bashrc}}} to put {{{/usr/local/bin}}} before all others. * Finally, after that, was able to create a spatial database based on the !GeoDjango documentation instructions: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#creating-a-spatial-database-template-for-postgis [[br]] Note: this file is located in our project repository at: {{{urt/etc/sh/create_template_postgis-1.5.sh}}} * created a database for URT: {{{ createdb -T template_postgis urt }}} == 3. Get source code == * {{{ cd PROJECT_DIR }}} * then did a git clone, which now includes bootstrap.py [ProjectSetup#Git git instructions] something like: {{{ git clone git@github.com:ParsonsAMT/URT.git }}} == 4. Install Python libraries == * {{{cd PROJECT_DIR/urt/trunk/ }}} * ran {{{python bootstrap.py}}}, which created {{{./bin/buildout}}} * ran {{{./bin/buildout -c buildout.cfg}}}, which created all the buildout stuff including project dependencies (psycopg2, south, PIL, ) and etc == 5. Django == * {{{ cp urt/local_settings.sample.py urt/local_settings.py}}} * edit {{{PROJECT_DIR/urt/trunk/urt/local_settings.py}}} - Probably all you need to change is the database username * run {{{./bin/django syncdb}}} and {{{./bin/django migrate}}} to create the project data model * and finally: {{{./bin/django runserver}}} * then, visit http://localhost:8000 in your web browser to test == 6. Other misc == * to view the database, you can use this Django shortcut * you can edit data via the Django admin interface: http://localhost:8000/admin/ * Problems logging in? error: {{{psql: FATAL: Ident authentication failed for user "urt"}}} this was helpful: https://help.ubuntu.com/10.04/serverguide/postgresql.html