Wiki source for SettingUp pvsapi


Show raw source

==Setting Up pvsapi==

Assuming you have already cloned the pvsapi git repo, you'll need to do the following:

~- Install the following in your apache configuration where appropriate (if running apache2 you can just create a new file under sites-available, load the contents there, and then link to it from site-enabled):

%%
WSGISocketPrefix /var/run/wsgi

<VirtualHost *:5001>
DocumentRoot /path/to/pvsapi/pvsapi

WSGIDaemonProcess pvsapi threads=10 display-name=%{GROUP} python-path=/path/to/pvsapi/pvsapi
WSGIProcessGroup pvsapi

WSGIScriptAlias / /path/to/pvsapi/pvsapi/wsgi.py process-group=pvsapi
WSGIApplicationGroup %{GROUP}

WSGIScriptReloading On

<Directory /path/to/pvsapi/pvsapi>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
CustomLog "/var/log/apache2/pvsapi/access.log" combined
ErrorLog "/var/log/apache2/pvsapi/error.log"

Header set Access-Control-Allow-Origin "*"
</VirtualHost>
%%

Also, if running apache2, create an entry in ports.conf:

%%
NameVirtualHost *:5001
Listen *:5001
%%

~- Change your pvsapi/settings.py file whee appropriate:

%%
DEBUG = False
AUTH_ENABLED = False

APP_PATH = '/path/to/pvsapi/' # NOTE: Do not include the extra pvsapi at the end!

RELEASE_ID = 2

ADMINS = ['webmaster@votesmart.org']
SMTP_HOST = 'mail.votesmart.org'

DB_HOST = 'hostname'
DB_USER = 'user'
DB_PASS = 'password'
DB_NAME = 'pvsadmin'
DB_PORT = '6432'

REDIS_HOST = 'votesmart.org'
REDIS_PORT = 6379
REDIS_DB = 0

MEMCACHE_HOST = '127.0.0.1'
MEMCACHE_PORT = 11211

INPUT_LIMIT = 25
OUTPUT_LIMIT = 100

PHOTO_URL = 'http://static.votesmart.org/canphoto/'
API_URL = 'http://localhost:5001/'

API_MAJOR_VERSION = 2

CACHE_EXPIRE_LONG = 86400 # 1d
CACHE_EXPIRE_MED = 21600 # 6h
CACHE_EXPIRE_SHORT = 3600 # 1
%%

~- Install memcached and make sure it's listening on port 11211

~- Install the following python dependencies:
~~- flask
~~- Flask-RESTful
~~- mimerender
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki