Django on OpenSolaris and ...

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.

My goal was to set up Django development environment with MySQL database. Django is a Python based web development framework, so the complete list of tools is as the following:

OpenSolaris

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 as 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 is at /usr/mysql and version 4 is at /usr/sfw/bin.

Mac OS X

Python 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:

$ python
>>> import MySQLdb
>>> print MySQLdb.apilevel
2.0
>>>

Verify also that django-admin.py is in your path.

Comments:

Cool, nice to see the Web Stack Django package being used!

Posted by Jyri Virkki on December 04, 2008 at 07:28 PM CET #

Post a Comment:
Comments are closed for this entry.
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today