Steps I went through (am going through?) to setup djedna
This process was developed by trial and error on my part and most likely contains many errors and ommissions. Please leave a note if you discover any.
0. Make sure you have python 2.4 or later. If installing on MacOSX using MacPorts? and python25, you will not only need to install python25, but also py25-crypto and py25-hashlib to get MD5 support and py25-zlib to get support for PNG.
1. Install apache and mod_python
I hadn't yet installed apache on my development box, so I did this now. According to Django documentation, Apache 2.x (prefork MPM) and mod_python 3.x. The versions available via ubuntu edgy apt-get are new enough, though others (I'm looking at you dapper) may need to install mod_python manually (NOTE: mod_python needs to be compiled against the python version you're using). I'm told it's easy.
- For ubuntu dapper dan, make sure you you install apache2-threaded-dev and then:
- ./configure --with-apxs=/usr/bin/apxs2
- make
- make install
2. Install and setup postgressql and python-psycopg2
If necessary install PostgreSQL. Not sure it matters too much which version (I'm using 8.2). Create the djedna user and database.
sudo -u postgres createuser -D -R -S -P djedna sudo -u postgres createdb -E utf8 -O djedna djednaOn MacOSX with Python 2.5 you will have to install psycopg2 manually (http://www.initd.org/pub/software/psycopg/). After unzipping the archive, you will need to edit the setup.cfg file to point it to your pg_config file if it's not already on your path (mine was installed at: /opt/local/lib/postgresql81/bin/pg_config since I'm using PostgreSQL 8.1).
3. Download and install py-tagger (http://media.liquidx.net/static/pytagger/pytagger-0.5.tar.bz2)
4. (OPTIONAL) Download and install eyeD3 (http://eyed3.nicfit.net/)
5. Download and install the Python Imaging Library (apt-get install python-imaging or port install py25-pil or http://www.pythonware.com/products/pil/)
6. Download and install django and djedna
Djedna uses django pre-0.97 (i.e. the development version) (http://www.djangoproject.com/documentation/install/#installing-the-development-version).
For djedna
cd ~/projects svn co http://djedna.org/svn/djedna/trunk djedna/ --username xxxx --password xxxxOmit username and password for anon access.
7. Setup config files
You will probably need separate config files. Copy/rename djedna/config/dev.py to something unique. I used HOSTNAME_dev.py (e.g. horatio_dev.py). Do the same to djedna/logger/dev.cfg. Make changes to the new files as necessary. Note: config/dev.py contains the name of the logger cfg file.
The way config files are handled will probably change in the future.
8. Create djedna database
Use the django management utilites to create the djedna database.
cd ~/projects/djedna/djedna DJEDNA_ENVIRONMENT='horatio_dev"; export DJEDNA_ENVIRONMENT python manage.py syncdb python manage.py syncdb catalog
Use the config file name you created in step 6 for the DJEDNA_ENVIRONMENT variable. You will be asked to create a superuser for the admin system at this point.
9. Create path to djenda files
The apache virtual host config file example that follows assumes djedna files are located at /var/django/djedna. Since I have apache running on my development box, I merely linked my development directory into /var/django/ as follows(note trailing dot when using ln -s):
cd /var sudo mkdir django cd django ln -s ~/projects/djedna/djenda .
10. Setup virtual host in apache
Insert the contents of ApacheConfig into the appropriate apache config file. These are the lines I had to change (or at least be aware of):
ServerAdmin admin@gumption.com ServerName djedna.gumption.com <Directory /plato/audio> SetEnv DJEDNA_ENVIRONMENT prod PythonOption DJEDNA_ENVIRONMENT prod ## several Alias /catalog/file /plato/audio Alias /catalog/cover /var/djedna/cover Alias /catalog/zip /var/djedna/zip Alias /robots.txt /var/www/gumption/robots.txt ErrorLog /var/log/apache2/error.djedna.gumption.log CustomLog /var/log/apache2/access.djedna.gumption.log combined
For the DJEDNA_ENVIRONMENT setting you should use the name of the config file create in step 4 (without the .py).
11. Include admin-media files
link or copy in the media files for the admin site
cd /var/djange/djedna/media ln -S /usr/lib/python2.4/site-packages/django/contrib/admin/media admin-media
12. Other issues with setup
DJedna couldn't find the template dir. The settings file config/dev.py (or the appropriate settings file) sets the value of TEMPLATE_DIRS, which originally had a relative difinition ("templates"). I needed to switch that to the full path ("/var/django/djedna/templates"). Apparently, the relative path sometimes works, but it never did for me.- dev.py has been updated with a full path.
- I had a permissions problem with the log file. First of all, the log file could not be written from within apache (user "www-data") because the directory was not writable to all. When this was fixed, writability of the log file depended on who created it: apache or me (via manage.py operations). The other would not be allowed to write as the file, by default, was not writable to all. Though I've worked around these issues, I do not know what their ultimate solution is.
13. Populate data
Go to town. See PopulateDb.
