User Tools

Site Tools


eve-central:devserverhowto

Development Server Setup

The EVE-Central web application is written in Python, making use of the Cherrypy HTTP framework. PostgreSQL is used as database backend, short-term caching relies on Memcached. For a development server no httpd is required because CherryPy comes with its own little webserver.

Required packages

Linux

You need to install the following software either from source or using your favorite packaging system. Depending on your Linux distribution your mileage may vary:

  • Python 2.6
  • PostgreSQL 8.4
  • Memcached

The following Python packages are required:

  • psycopg2
  • python-memcached
  • numpy
  • pyro
  • routes
  • mx-base

FreeBSD

The following packages need to be installed from Ports:

  • lang/python26
  • www/py26-cherrypy
  • databases/postgresql84-server
  • databases/memcached
  • databases/py26-psycopg2
  • databases/py26-memcached
  • math/py26-numpy
  • devel/py26-pyro
  • www/py26-routes
  • lang/py26-mx-base

Getting the source

Perform the following steps:

  1. Create a user account on http://gitorious.org and add your ssh public key to your account
  2. Create a clone of the repository for yourself (click on “Clone Repository”)
  3. Checkout your newly cloned repository to your local machine by using the SSH method. The repository URL is shown in your repository page. The following command will checkout the repository to the local directory “eve-central”.
#> git clone [URL] eve-central

For a quick look, you could even checkout directly from Yann's master repository. But then you're not able to commit anything unless Yann grants you write access to his repository:

#> git clone http://git.gitorious.org/eve-central/core.git eve-central

Local configuration

The configuration for CherryPy is in the file web/site.config. Please don't edit this file, but create a file named 'web/site.config.local' where you can override the CherryPy default configuration. A list of configuration directives is available in the CherryPy documentation.

Example file:

######################################################################
# Please edit config for you local installation in this file.
# It will override the settings in site.config.
# This file is excluded from Git, so local changes will not affect
# the EVE Central master site

[global]
tools.staticdir.root = "/var/www/eve-central/static_web"
engine.autoreload_on = True
engine.autoreload_frequency = 1
log.screen = True
server.socket_port = 8080
server.socket_host = "0.0.0.0"


[/favicon.ico]
tools.staticfile.filename = "/var/www/eve-central/static_web/favicon.ico"

Source code changes

Because some paths and database settings are hardcorded at the moment, you need to change a few lines:

--- a/lib/evecentral/display.py
+++ b/lib/evecentral/display.py
@@ -19,10 +19,10 @@
 
 def template(file,session):
     t = None
-    #try:
-    t = Cheetah.Template.Template(file = '/www/eve-central.com/web/templates/' + file)
-    #except:
-    #    t = Cheetah.Template.Template(file = 'templates/' + file)
+    try:
+        t = Cheetah.Template.Template(file = '/www/eve-central.com/web/templates/' + file)
+    except:
+        t = Cheetah.Template.Template(file = 'templates/' + file)
 
     try:
         t.isigb = session['isigb']
--- a/lib/evecentral/evec_func.py
+++ b/lib/evecentral/evec_func.py
@@ -110,7 +110,7 @@
 
 
 def db_con():
-    svndb = psycopg2.connect(database='evec', user='evec', host = 'localhost', port = '9999')
+    svndb = psycopg2.connect(database='evec', user='evec', host = 'localhost', port = '5432')
     return svndb

Please make sure that you don't commit your local changes to the upstream repository. On the long row, this should be fixed using some kind of global/local config file for setting installation paths and database credentials.

Database

  • Create a PostgreSQL user “evec” and database “evec” and allow passwordless access from localhost
  • import database schema
#> psql evec < db/schema.sql
#> zcat latest_db.dump.gz | psql evec

Launch

#> cd web
#> python launch.py

Try to access the CherryPy http server at http://localhost:8080. If you are using the settings from site.config.local above, you should see the log messages on your terminal.

The process can be killed with:

#> kill `ps | grep "python launch.py" | grep -v grep | cut -d " " -f 1`
eve-central/devserverhowto.txt · Last modified: 2015/05/06 19:17 by 107.133.181.39