[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major r
From: |
catmat |
Subject: |
Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005) |
Date: |
Thu, 27 Jan 2005 08:32:29 +1100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041231 |
Ian Haywood wrote:
If not, is there any interest in a Web client
in Python? The BaseHTTPServer class provides the same features as
Java servlets only heaps easier to use.
I thought I'd use this to revise apache server.
I was trying to do a web login page using python as a cgi script.
this was what was in /etc/httpd/commonhttpd.conf
Directory /home/*/public_html>
AllowOverride All
Options MultiViews +Indexes Includes +FollowSymLinks
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
AllowOverride All
SetHandler cgi-script
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
<Directory /home/*/public_html/gnumed>
Options
AllowOverride All
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
The important Option is ExecCGI in /home/*public_html/cgi-bin,
which allows CGI scripts to execute in that directory.
attached are the files
~/public_html/gnumed/login.html, ~/public_html/cgi-bin/login.py ,
~/public_html/cgi-bin/checkpath.py
notice login.py begins with
#! /usr/local/bin/python2.4
to specify what program is the scripting engine.
An important point is that apache server uses the unix file and
directory permissions.
I had to do chmod (change mode) 0755 ( which is permissions user: rwx
group: r-x others: r-x ,
r is 4 , w is 2, and x is 1 , so 4 ORed with 1 is 5 )
This has to be performed on all the directories below where the gnumed
client python files are kept
from home/$user upwards to the directory below the python files needing
to be executed and including
those files. ( e.g. gmLoginInfo, gmLog)
Also, since gmLog creates a log file for gmLoginInfo, it seemed to want
to create as /var/www/.login/login.log
therefore had to
create /var/www/.login and login.log ,
chmod 0745 /var/www/.login , and
chown apache /var/www/login.log,
to get the existing gnumed backend stuff to run as imports into the
python cgi script.
The main idea is that apache server runs as user apache, which is
effectively in group others,
so x (execute) permission for others has to be set , in order to access
the directories , and execute
the python files, and any files written to by any python script need to
pre-exist with apache as owner
(so can read and write).
This is probably pretty basic to people used to apache, but it's here
for revision if needed.
Also , I wasted a few hours trying to figure out why the backend
wouldn't import.
Login
username
password
#!/usr/local/bin/python2.4
debug = True
import sys, cgi
import cgitb
cgitb.enable()
#cgi.test()
print "Content-type: text/html"
print
print "<html><body>"
import checkpath
print sys.builtin_module_names
print sys.path
try:
from Gnumed.pycommon import gmLoginInfo
print "imported gmLoginInfo"
except:
raise
print "<h4>unable to load gmLoginInfo</h4>"
f = cgi.FieldStorage()
if not f.has_key("username"):
print "Error: missing username"
elif not f.has_key("password"):
print "Error: missing password"
else:
if debug:
u = cgi.escape(f["username"].value)
p = cgi.escape( f["password"].value)
#u=f["username"].value
#p =f["password"].value
print "username=", u
print "<br>"
print "password=", p
print "</body></html>"
import sys
path="/home/sjtan/projects/gnumed4/gnumed/gnumed"
if path not in sys.path:
sys.path.insert(0,path)
pass
- [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), J Busser, 2005/01/25
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005),
catmat <=
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), Ian Haywood, 2005/01/26
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), catmat, 2005/01/28
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), Karsten Hilbert, 2005/01/28
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), catmat, 2005/01/28
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), Ian Haywood, 2005/01/28
- Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), catmat, 2005/01/29
- web frontend/patient singleton was: Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), Karsten Hilbert, 2005/01/29
- Re: web frontend/patient singleton was: Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), catmat, 2005/01/29
- Re: web frontend/patient singleton was: Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), Karsten Hilbert, 2005/01/29
- Re: web frontend/patient singleton was: Re: [Gnumed-devel] gnumed ideas 0.1 and post-0.1 (was Time for a major re-think in 2005), catmat, 2005/01/30