Read Me
1. pgApex
Web Rapid Application Development tool for PostgreSQL.
2. How it works
CherryPy is HTTP server (listener) which keep information about session. CherryPy forwards requests including session variables from client to PostgreSQL database. In database, stored procedure using session information, variables, etc. and database tables "draws" application pages and return html (java script) code to CherryPy. CherryPy than returns html page to client. And back to start...
3. What you need?
PostgreSQL, Python, CherryPy (http://www.cherrypy.org/), psycopg2 (http://initd.org/psycopg/download/ or http://www.stickpeople.com/projects/python/win-psycopg/ for windows), , ..., plpgsql as programming language, hstore data type, pldbgapi for debuging, adminpack for I don't know why.
I use PostgreSQL v9.1, Python 3.2, CherryPy 3.2 and psycopg2-2.4.2.
It can work with PostgreSQL 8.x and 9.x and Python 2.6, CherrPy 2.3. Only diference is that you have to change print(something) to print something in pgApex.py.
a) Install Python and PostgreSQL.
b) Download and install CherryPy and psycopg2-2.4.2.
c) Create database and login role with password.
CREATE DATABASE <username>
WITH OWNER = <username>
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'Serbian (Latin)_Serbia and Montenegro (Former).1250'
LC_CTYPE = 'Serbian (Latin)_Serbia and Montenegro (Former).1250'
CONNECTION LIMIT = -1;
Be aware that PostgreSQL make difference between downcase and upcase letters. So pgApex is acctually pgapex and "pgApex" is pgApex. If you want to use upcase letters than use ".
CREATE ROLE <username> LOGIN PASSWORD '<password>'
SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;
d) Unzip pgApex zip in some directory. Open console in that directory
e) Import file create_pgApex_schema.sql into database (it will create schema and hstore and some other extensions) - type password
psql.exe -U <username> < create_pgApex_schema.sql
f) Import file insert_data_into_pgApex_schema.sql into database (it will populate tables with values) - type password
psql.exe -U <username> < insert_data_into_pgApex_schema.sql
g) Open pgApex.py in editor and change lines
conn = psycopg2.connect("dbname=<database name> user=<username> password=<password>")
h) Start pgApex.py typing
python pgapex.py
i) Start browser and open page http://localhost:8080/q.
You will get Login page. Put a as username and a as password (a/a) and you will login to page 1.
4. Still, I am not sure ...
Is it better to wrote all code in python (not to use stored procedure)? This way same code can be used for many databases.
Which js framework to use? jQuery is first choice (I use hive-dark theme).
5. Comment
This is my first OSS project. I have a lot other job to do, so time is short.
Đorđe Cvijanović
cdorde@gmail.com