Django on OpenSolaris and ...
By lr on Dec 04, 2008
I recently started to play with Django and the first task was actually to set it up on all the platforms I am currently using (SXCE (build 96), OpenSolaris 2008.11 (RC2) and Mac OS X 10.5). The setup was not difficult and the mighty internet helped to answer all my questions but since the setup steps differ on each of the platforms I decided to write down what I learned.
All the required packages are available, so the setup was just a matter of issuing a few IPS commands.
MySQL 5 is installed by command
$ pfexec pkg install SUNwmysql5.
It is installed in
/usr/mysql. It is controlled by
SMF, so to start the MySQL
server it is necessary to enable it at first. This can be done either through a command line
$ pfexec svcadm enable mysql) or through a GUI tool
(go to System/Administration/Services for a GUI tool, which shows available services and
makes possible to enable or disable them).
Python version 2.4.4 is installed by default. MySQLdb is packaged
SUNWmysql-python package, so it gets installed by issuing
$ pfexec pkg install SUNWmysql-python.
Django package also exists but it is stored in webstack repository, so
this repository has to be added to a list of known authorities:
$ pfexec pkg set-authority -O http://pkg.opensolaris.org/webstack webstack
$ pfexec pkg refresh
$ pfexec pkg install Django
It is also a good idea to add MySQL in the PATH, e.g.,
$ export PATH=$PATH:/usr/mysql/bin
SXCE (build 96)
MySQL 5, MySQLdb, and Python are already installed, so
only Django needed to be set up. I just downloaded the tar ball, unziped and
untared it and then run inside the Django directory (as root):
# python setup.py install. Again, set path to MySQL and enable it
through SMF. Note, that two versions of MySQL are actually installed -- version 5
/usr/mysql and version 4 is at
Mac OS XPython is available by default. I downloaded MySQL binaries as a dmg package and installed it together with MySQL.prefPane, which integrates in System Preferences and makes possible to start and stop the MySQL server easily. The installed path is
/usr/local/mysql. For Django and MySQLdb installation I found an excellent article How to install Django with MySQL on Mac OS X, which I followed.
Test the Installation
To make sure that everything is installed you can try the following:
>>> import MySQLdb
>>> print MySQLdb.apilevel
Verify also that
django-admin.py is in your path.