user
pass
 
 
pure ingredients
2009-06-27 16:31
hotelevropi
2009-06-27 16:22
kaotonik
2009-06-27 16:20
Sites running on madpy
2009-06-27 16:03
Welcome madcorf
2009-05-03 17:24
 
 
@ welcome to madpy!documentationinstallation
from thk 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:
  1. apache web server (tested in versions 2 +)
  2. mod_python (tested in versions  3.3.1 +)
  3. cheetah templating engine
  4. postgresql (tested on 8.2 + )
  5. psycopg2 (python db api for postgresql)
  6. pil (python-imaging)
  7. PyRSS2Gen (for creating rss feeds)
  8. python-crypto
  9. A mail server so that madpy can send emails (an external mail server can be used too)
In a typical Linux distribution based on debian (debian, ubuntu, mint ..) you can write in your console:
sudo apt-get install apache2 libapache2-mod-python python-cheetah postgresql python-psycopg2 python-imaging python-pyrss2gen python-crypto
2. Extract the tgz madpy file in a directory.
tar xvzf madpy.tgz
You 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_icons


3. 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/hosts
5. 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