[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] GNUmed on Mac OSX
Re: [Gnumed-devel] GNUmed on Mac OSX
Mon, 05 Feb 2007 07:29:20 +0800
it is what debian installs, and runs out of /var/www/webgnumed_test1 .
The apache used is apache2, which has an Include in /etc/apache2/apache2.conf
which looks inside /etc/apache2/sites-enabled/ for further configuration files,
(any file), which the default is 000-default.
According to the tutorial in apache2 mod_python docs package, a line
is added to add a module handler for .py files, which is the
publisher handler transfers the last part of a url which follows a .py part of
the url as a function name, and the parameters will be a req(uest) object, and
any form input fields will come has further parameters for the function.
The tutorial shows that mod_python can be used as the action handlers of
html form tags, e.g.
<form action="myapp/handler/monolithic.py/func1" type="POST">
and the ui is still html pages. In order to return dynamic web pages,
the req.write(..) function can be used within a handler function, to write
parts of the web page, otherwise static pages can be done by opening a file
and returning its contents in the return statement of the function.
So to do a part static/dynamic page, one could use unique tags within a
html page template, and have them occur at the start of the line, and use
the " for line in file('filename.html', 'r'):" and req.write each line,look for
then insert the dynamic content there, then continue to req.write the rest.
This is sort of minimal dependency templating . You can also use the psp feature
as well, but then some your python code ends up in psp pages, and some of it
ends up in handlers.
One tricky bit was that once you enter the first python function, req.writing
or returning further html pages, those pages should use function names as
urls without the "myapp/monolithic.py/ " part, as this seems stuck in the
req object as a prefix to urls .
hope that helps. I need to call some environment function in python to
find out what environment exists ; I so far haven't bothered , and just
stuck a "BASEDIR" global variable at the start of the script,
so that html files can be found by absolute pathnames.
I used soft links in the /usr/lib/python2.4/site-packages directly to
soft link "Gnumed" to the client directory in my home directory.
I tried importing other scripts within the /var/www.. script, but it
can't find it, even though it is in the same directory, so it only
seems to be easy to import installed python packages.
On Sun Feb 4 23:06 , Karsten Hilbert <address@hidden> sent:
>On Mon, Feb 05, 2007 at 08:30:55AM +1100, syan tan wrote:
>> I came across an import error in gmLog , when trying to import Gnumed
>> client library inside a mod_python script.
>> Can gmLog configure a suitable log file in the /tmp directory if it
>> can't find a command line argument regarding the log ?
>If you tell me a bit more about the mod_python - what is the
>environment it works in etc (Apache ?) - I am sure we can
>work out some solution or other.
>One could, for example, create an apache-demon-user writable
>/var/log/gnumed/gnumed.log or /var/log/gnumed.log. Or one
>could enable the Apache user to write to
>Those are the built-in options.
>I have added /tmp/gnumed.log as the second-to-last location
>it tries in HEAD.
>Or else one could catch the ImportError and explicitely
>setup a cLogTargetFile() and set gmDefLog appropriately (see
>__main__'s use of __open_default_logfile()) for examples.
>GPG key ID E4071346 @ wwwkeys.pgp.net
>E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
>Gnumed-devel mailing list