Build up the Pepdock Server
Content:
- Setting Up Environment. (Apache, MySql, Mod_wsgi)
-
Edit Django and smoothserver
-
Add model to SmoothServer/SmoothPDZ
Setting Up Environment. (Apache, MySql, Mod_wsgi, Django)
1. Suppose Apache is already installed and working on the server.
2. Install apxs2:
sudo yum install httpd-devel
3. Install mod_wsgi. (http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide)
Download mod_wsgi package from here.
Uncompressed the source package and run:
./configure make make install
Edit the file "/etc/httpd/conf/httpd.conf " and add the following lines
############################################################## # # add for SmoothDock by Weiyi # ############################################################## LoadModule wsgi_module /usr/lib/httpd/modules/mod_wsgi.so AddHandler wsgi-script .wsgi WSGIScriptAlias /wyizhang /usr/local/smoothdock/www/hello.wsgi # This is for the development and debugging WSGIScriptAlias /pepdock /usr/local/smoothdock/www/smoothserver/django.wsgi
Here is the hello.wsji and django.wsgi
To test mod_wsgi, check "localhost/wyizhang/" in browser.
4. Install django package.
First, download Django-1.1.1.tar.gz. Then
tar xzvf Django-1.1.1.tar.gz
cd Django-1.1.1
sudo python setup.py install
5. Configure Mysql
mysqladmin -u root password XXXXXXX #set the mysql root password
create dataabase smoothserver;
GRANT ALTER,INDEX,SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON smoothserver.* \
TO 'smoothdock'@'localhost' IDENTIFIED by '*****';
mysql -u root -pXXXXXXX smoothserver < smoothserver.20100420.sql
6. Don't forget configure the service start automatically when booting the system.
Edit Django and smoothserver
1. Edit the file "/etc/httpd/conf.d/python.conf " and add the following lines
Alias /smoothserver_media /var/www/html/smoothserver/media
<Location "/smoothserver_media">
SetHandler None
</Location>
Alias /smoothserver_jobs /var/www/html/smoothserver/jobs
<Location "/smoothserver_jobs">
SetHandler None
</Location>
<LocationMatch "\.(jpg|gif|png|css|js)$">
SetHandler None
</LocationMatch>
2. Copy the "smoothserver" package to "/usr/local/smoothdock/www/smoothserver/"
3. Copy the "PyMM" package to "/usr/local/PyMM"
4. Copy the "smoothserver" html package to "/var/www/html/smoothserver/"
Add model to SmoothServer/SmoothPDZ
- Add the model in the models.py
- Check the model by running:
python manage.py sql SmoothPDZ
- Sync the database by running:
python manage.py syncdb
- Restart the web server