Installation on MS Windows systems
De MorfeoWiki
Contenido |
Installing django
EzWeb is based on django, an opensource python web framework. Django allows developing database-driven web-apps in a flexible and agile way. Therefore, installing django is the first step for installing EzWeb.
Django needs for working the following components:
- Python virtual machine (interpreter) - Relational DataBase engine (postgresql, mysql, slqlite, etc) - Python DataBase Driver - Django Source Code
Recommended software components for 64 bits Windows systems:
- Python 2.6 virtual machine. download - PostgreSQL 8.3.1. download - Python library for PostgreSQL. download - Django 1.0.2. download
Installing Python 2.6 Virtual Machine
Run python-2.6.1.amd64.msi. The installer is very intuitive so additional info is not required.
Installing PostgreSQL DataBase Server
Unzip postgresql-8.3.1-1.zip and run postgresql-8.3.msi. It's a very simple wizard. It's necessary to set a root password for the database server for creating users and databases. In order to manage databases in a confortable way, a graphical tool can be used. pgAdmin is the official front end for postgresSQL.
Installing Python DataBase Driver
Run psycopg2-2.0.8.win-amd64-py2.6-pg8.3.4-release.exe installer. The installer must use the python 2.6 interpreter (several versions of the python virtual machine can be installed in machine)
Installing django Source Code
Extract Django-1.0.2-final.tar.gz and change to the new directory. Run python setup.py install
Installing EzWeb
Setting up PostgreSQL DataBase Engine
Using the pgAdmin tool, it's easy to create a database user and a database required for running EzWeb. To connect to the database server from the pgadmin, the root password created during the installation will be required. EzWeb need the following configuration:
- a database user called 'ezweb'. The password will also be 'ezweb' - a database instance called 'ezweb'
Downloading EzWeb Source Code from Repository
In this section, the tortoiseSVN subversion tool will be used.
Using tortoiseSVN, it's easy to check out the project source code from the following URL: https://svn.forge.morfeo-project.org/svn/ezwebplatform/ezweb_platform/src/trunk to a local directory. c:\ezweb it's the recommended target.
EzWeb database model creation
Within the ezweb source code directory, there is a configuration file (settings.py). It's necessaty to edit some options of this file.
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
If during the installation, all recommendations have been followed, it's not necessary change anything more. If the database user it's different to 'ezweb', the person who install can change it in this file. All configuration properties are hosted in this file.
If everything is correct, it's time to create the database scheme of the EzWeb application. Inside the ezweb source code folder, execute:
python manage.py syncdb
or
python manage.py syncdb --settings=settings
If something goes wrong, check that configuration of the database server and the settings of the configuration file are correct.
Installing EzWeb required python libraries
Testing EzWeb
Inside the EzWeb source code folder, run:
python manage.py runserver
or
python manage.py runserver --settings=settings
If the command-line blocks waiting for requests, EzWeb it's correctly installed. If there are any problems, the EzWeb output will show a description of them.
For testing EzWeb, try to connect via browser to http://localhost:8000
Production ready installation
The 'runserver' method, allows users to run a limited version of EzWeb. This version allows ONE user request at the same time. So, if a request needs to invoke another service that it's deployed on the same process, EzWeb will block.
This installation it's enough for simple activities and a low amount of concurrent users. For advanced uses, a complete web server server is required.
Installing Lighttpd Web Server
Download lighttpd 1.4.9b for windows and run it. The installation it's very easy.
After that, create the file: %Lighttpd_root%\etc\lighttpd.conf and paste the following content:
A bit of customization is needed, so some changes will be required:
server.bind = "machine name"
fastcgi.server = ( "/django" =>
(( "host" => "ip addres",
"port" => 8000,
"check-local" => "disable",
"docroot" => "/" # remote server may use
# it's own docroot
))
)
alias.url = (
"/media" => "C:/Python26/Lib/site-packages/django/contrib/admin/media",
"/ezweb" => "C:/ezweb/trunk/media",
"/repository" => "Path to the folder were gadgets are published"
)
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^(/test.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/django$1",
)
Installing FastCGI python library
Flup is a FastCGI protocol implementation written in Python. This software aims to communicate the web server with FastCGI-compliant applications. Download flup
Extract file and copy the flup directory to the %PYTHON%\lib\site-packages
Running EzWeb
EzWeb can be started as a normal FastCGI server, just typing:
python manage.py runfcgi method=threaded host=ip_addr port=8000
Running Lighttpd
Lighttpd web server, starts from command-line, with the following:
cd path_to_lighttpd_directory lighttpd.exe -f ..\etc\lighttpd.conf