from
thk on 2008-09-24 10:55
(to follow this guide you should have some basic knowledge of configuring apache, and using linux command line interface)1.Dependencies
Madpy has been developed on top of apache module mod_python.
It is therefore necessary the existence of apache server ( has not been tested with apache versions < 2) , and mod_python 3.3.1 (provided with most modern linux distributions ).
In brief the following packages are required:
- apache web server (tested in versions 2 +)
- mod_python (tested in versions 3.3.1 +)
- cheetah templating engine
- postgresql (tested on 8.2 + )
- psycopg2 (python db api for postgresql)
- pil (python-imaging)
- PyRSS2Gen (for creating rss feeds)
- python-crypto
- A mail server so that madpy can send emails (an external mail server can be used too)
sudo apt-get install apache2 libapache2-mod-python python-cheetah postgresql python-psycopg2 python-imaging python-pyrss2gen python-crypto2. Extract the tgz madpy file in a directory.
tar xvzf madpy.tgzYou should give write permissions on directories files and media/user_icons to the user under which apache runs. Typically this is www-data
chown -R :www-data files
chmod -R 775 files
chown -R :www-data media/user_icons
chmod -R 775 media/user_icons3. Apache
Place the following configuration of the apache virtual host
<Directory /path/to/madpy>
SetHandler mod_python
PythonHandler main
PythonDebug On
</Directory>
<Directory /path/to/madpy/media>
SetHandler None
</Directory>4. A development site example
For example you can install madpy on your computer so you can play with it. create a new apache virtual host with the following configuration.
<VirtualHost *>
ServerAdmin root@localhost
ServerName dev.madpy.local
ServerAlias madpy.local
DocumentRoot /path/to/madpy
<Directory /path/to/madpy>
SetHandler mod_python
PythonHandler main
PythonDebug On
</Directory>
<Directory /path/to/madpy/media>
SetHandler None
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/dev_madpy_error.log
CustomLog /var/log/apache2/dev_madpy.log combined
ServerSignature On
</VirtualHost>
on a debian based distribution the configuration above should be put in a new file named dev.madpy.local in folder /etc/apache2/sites-available .
You can copy the configuration sample conf to this directory
sudo cp dev.madpy.local /etc/apache/sites-available/and you should enable it by giving
sudo a2ensite dev.madpy.local
sudo /etc/init.d/apache2 reload
to be able to access it with your web browser put a line in /etc/hosts :127.0.0.1 dev.madpy.local
you can do this by typing in the console
sudo echo "127.0.0.1 dev.madpy.local" >> /etc/hosts5. Database installation
You should already have created a postgresql user with superuser rights that can login with password (md5 authentication).
See a brief memo I have written for configuring logging in with password in Postgresql .
Inside madpy folder issue
chmod +x restoredb.sh
./restoredb.sh madpy db_user
First argument of the command is the database name that will be given to the new database.
You can choose any name you want , just later you will have to modify lib/tools/DBTool.py
Default database name in DBTool.py is madpy2.
Second Argument is the database user name .
You should already have created a postgresql user with superuser rights
that can connect to postgresql with a password.
You will be asked the password of this user to connect to Postgres.
6. Configuring madpy
Most of madpy configuration is in file
lib/settings/SiteSettings.py
Settings that you must change are:
ApplicationRoot="/path/to/madpy"
ServerName = "dev.madpy.local"
PortalAddress = "http://dev.madpy.local"
Modify according to your installation
And also file lib/tools/DBTool.py
there you should change the connection string for your database
self.ConnStr= "dbname = madpy user = db_user password = db_pass"
change values db_user , db_pass according to your installation.
8. You are ready to go!
Browse to http://dev.madpy.local with your browser.
Credentials for logging in as administrator are:
username : admin
password : mad