NOTE: These instructions are are work in progress as I rebuild my development machine (an aging Dual G5) after a crash-n-wipe-n-new-OS. March 2, 2008
These are the steps for installing DJ Edna on a MacOSX 10.5 (Leopard) machine. Also, keep in mind that a large TODO on my list is to simplify and improve the installation process, so I apologize in advance for the haphazard organic instructions. Check this page for updates (and hopefully improvements) to the installation process.
- Install MacPorts
- Installing MacPorts
- The rest of these instructions assume version 1.6.
- Install Python 2.5
sudo port install python25
and/orsudo port install py25-ipython
- Install PostrgeSQL 8.2
sudo port install postgresql82-server
- Create a default database instance.
sudo mkdir -p /opt/local/var/db/postgresql82/defaultdb sudo chown postgres:postgres /opt/local/var/db/postgresql82/defaultdb sudo su postgres -c '/opt/local/lib/postgresql82/bin/initdb -D /opt/local/var/db/postgresql82/defaultdb'
- OPTIONAL: Tweak your DBMS
- Consider increasing kern.sysv.shmmax by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf
- Create a default database instance.
- Start PostgreSQL
- Issue the postgresql82 start command.
sudo -u postgres /opt/local/lib/postgresql82/bin/postmaster -D /opt/local/var/db/postgresql82/defaultdb
or, if you want to launch it in the background:sudo -u postgres /opt/local/lib/postgresql82/bin/pg_ctl -D /opt/local/var/db/postgresql82/defaultdb -l logfile start
- If you wish to have postgresql82 start automatically on startup:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql82-server.plist
- Issue the postgresql82 start command.
- Install psycopg2
sudo port install py25-psycopg2
- Install wget
sudo port install wget
- Install py-tagger
wget http://media.liquidx.net/static/pytagger/pytagger-0.5.tar.bz2 bunzip2 pytagger-0.5.tar.bz2 tar xvf pytagger-0.5.tar cd pytagger-0.5 sudo python2.5 setup.py install
- Install the Python Imaging Library
sudo port install py25-pil
- Install Django
- DJ Edna uses Django pre-0.97 (i.e. the development/trunk version) You can see Django's more detailed instructions here.
mkdir ~/Development mkdir ~/Development/django cd ~/Development/django svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk sudo ln -s ~/Development/django/django-trunk/django /opt/local/lib/python2.5/site-packages/django sudo ln -s ~/Development/django/django-trunk/django/bin/django-admin.py /opt/local/bin
- DJ Edna uses Django pre-0.97 (i.e. the development/trunk version) You can see Django's more detailed instructions here.
- Install Django Logging Support Application
mkdir ~/Development/django/thirdparty mkdir ~/Development/django/thirdparty/django-logging-trunk cd ~/Development/django/thirdparty/django-logging-trunk svn co http://django-logging.googlecode.com/svn/trunk/djangologging
- Install Django Registration Support Application
mkdir ~/Development/django/thirdparty/django-registration-trunk cd ~/Development/django/thirdparty/django-registration-trunk svn checkout http://django-registration.googlecode.com/svn/trunk/registration
- Install DJ Edna
mkdir ~/Development/djedna cd ~/Development/djedna mkdir djedna-trunk cd djedna-trunk svn co http://djedna.org/svn/djedna/trunk/djedna
- Create DJ Edna Site Installation Directories
- NOTE: Replace {INSTALL_NAME} with a name to identify this DJ Edna installation by (e.g. nomads_with_homes would be a good choice for a band called Nomads With Homes). Just make sure the new name follows python module naming conventions.
sudo mkdir /opt/local/var/log/djedna sudo chmod 777 /opt/local/var/log/djedna mkdir ~/Development/djedna/djedna-local mkdir ~/Development/djedna/djedna-local/{INSTALL_NAME} cd ~/Development/djedna/djedna-local/{INSTALL_NAME} touch __init__.py mkdir config touch config/__init__.py mkdir templates file cover zip media log
- NOTE: Replace {INSTALL_NAME} with a name to identify this DJ Edna installation by (e.g. nomads_with_homes would be a good choice for a band called Nomads With Homes). Just make sure the new name follows python module naming conventions.
- Create DJ Edna Database User
sudo -u postgres /opt/local/lib/postgresql82/bin/createuser -d -R -S -P djedna
Remember the password you choose. You'll need it later for the DJ Edna config file. - Create DJ Edna Database
sudo -u postgres /opt/local/lib/postgresql82/bin/createdb -E utf8 -O djedna {INSTALL_NAME}_db - Configure DJ Edna Site Installation For Running With Django Development Server
- Copy the sample DJ Edna configuration file djedna/config/sample.py into your {INSTALL_NAME}/config directory and rename it dev.py. This will be the configuration we will use when running DJ Edna in the Django development server.
cp ~/Development/djedna/djedna-trunk/djedna/config/sample.py ~/Development/djedna/djedna-local/{INSTALL_NAME}/config/dev.py - Copy the sample logging configuration file djedna/config/logging_sample.py into your {INSTALL_NAME}/log directory and rename it dev.cfg.
cp ~/Development/djedna/djedna-trunk/djedna/config/logging_sample.py ~/Development/djedna/djedna-local/{INSTALL_NAME}/log/dev.cfg - Edit the new dev.py configuration file.
- Change the INSTALL_HOSTNAME setting to 'localhost:8000'
- Change the DATABASE_NAME setting to '{INSTALL_NAME}_db'
- Change the DATABASE_PASSWORD setting to the password you assigned the djedna database user.
- Change the TIME_ZONE setting to the time zone of your server. Possible values can be obtained by looking in the directory /opt/local/share/postgreql82/timezone/. The default is America/Chicago which maps to the file /opt/local/share/postgreql82/timezone/America/Chicago.
- Change the SECRET_KEY setting to a random string. It doesn't matter what it is really, as long as it's not easy to guess.
- Copy the sample DJ Edna configuration file djedna/config/sample.py into your {INSTALL_NAME}/config directory and rename it dev.py. This will be the configuration we will use when running DJ Edna in the Django development server.
- Update PYTHONPATH
- Add the following line to your ~/.bash_profile file:
export PYTHONPATH=~/Development/django/thirdparty/django-logging-trunk:~/Development/django/thirdparty/django-registration-trunk:~/Development/djedna/djedna-local:~/Development/djedna/djedna-trunk
- Reload ~/.bash_profile:
. ~/.bash_profile
- Add the following line to your ~/.bash_profile file:
- Initialize The DJ Edna Database
cd ~/Development/djedna/djedna-trunk/djedna/ python2.5 manage.py syncdb --settings={INSTALL_NAME}.config.devAs part of the syncdb process you'll be asked if you want to create a user by selecting a username and password. This user will be your initial administrator account. You'll need that info to log in to your DJ Edna install. - Run DJ Edna With The Django Development Server
cd ~/Development/djedna/djedna-trunk/djedna python2.5 manage.py runserver localhost:8000 --settings={INSTALL_NAME}.config.dev - Check That DJ Edna Is Running
- Browse to http://localhost:8000/ and you should get the DJ Edna home page with no errors (and no albums... yet).
- Install Apache2 (prefork MPM)
sudo port install apache2 +preforkmpm sudo cp /opt/local/apache2/conf/httpd.conf.sample /opt/local/apache2/conf/httpd.conf
- Install mod_python 3.1.1
- Install mod_python
sudo port install mod_python25
- Enable mod_python
- Add the following line to the bottom of the apache config file you created above (/opt/local/apache2/conf/httpd.conf):
LoadModule python_module modules/mod_python.so
- Add the following line to the bottom of the apache config file you created above (/opt/local/apache2/conf/httpd.conf):
- Install mod_python
- Start Apache
- IMPORTANT: Don't forget to disable Appleās default Web Sharing in the System Preferences.
- Issue the apache2 start command.
sudo /opt/local/apache2/bin/apachectl -k start
- Browse to http://localhost/ and you should get the "It works!" message.
- If you wish to have apache2 start automatically on startup:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
- Configure DJ Edna Site Installation For Running With Apache
- Copy the dev.py configuration file you created above into your {INSTALL_NAME}/config directory and rename it apache.py.
cp ~/Development/djedna/djedna-local/{INSTALL_NAME}/config/dev.py ~/Development/djedna/djedna-local/{INSTALL_NAME}/config/apache.py - Edit the new apache.py configuration file.
- Change the INSTALL_HOSTNAME setting with the actual hostname you plan on running your site under (i.e. 'nomadswithhomes.com')
- Copy the dev.py configuration file you created above into your {INSTALL_NAME}/config directory and rename it apache.py.
- Configure Apache Virtual Host
- Create the virtual host config file.
- Insert the following text into the myband_vhost file:
- Activate the new config.
- Change file permissions.
- Restart apache.
sudo /opt/local/apache2/bin/apachectl -k restart
- Check That DJ Edna Is Running
- Browse to http://{MYBAND_URL}/ and you should get the DJ Edna home page with no errors (and no albums... yet).
- Add Albums
- Go to town. See PopulateDb.
