Apache Server configuration support - How do I set Apache to excecute a .py script?

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > October 2005 > How do I set Apache to excecute a .py script?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How do I set Apache to excecute a .py script?
Christian

2005-10-24, 4:44 pm

I'm trying to install the CMS Zope via FTP (because it's the only way to
my web hotel) so I wonder if I can set an .htaccess file to make Apache
interpret a .py file as a file to be executed as a Python script or as a
..cgi script that calls /usr/local/python.

Any surgestions and BTW does anybody have experience in installing Zope
via FTP?


Thanks

Chris
Tim Hammerquist

2005-10-24, 4:44 pm

Christian <christian@spam.no> wrote:
> I'm trying to install the CMS Zope via FTP (because it's the
> only way to my web hotel) so I wonder if I can set an
> .htaccess file to make Apache interpret a .py file as a file
> to be executed as a Python script or as a .cgi script that
> calls /usr/local/python.


Place a "shebang" line at the top of your script such as:

#!/usr/local/python

....though I'd double check to make sure the Python binary is
actually at that location. Perhaps /usr/local/bin/python

Then place the script in a directory on the server for which
Apache has enabled ExecCGI. Make sure the script has
a permissions (mode) setting of 755.

> BTW does anybody have experience in installing Zope via FTP?


A Python ML/NG would be a much better place to get help with
this question.

Tim Hammerquist
--
Show me something that beats a Natural Twenty,
and I'll show you hateful LIES!
-- Red Mage, 8-Bit Theater <http://nuklearpower.com/>
Christian

2005-10-24, 4:44 pm

Tim Hammerquist wrote:
> Christian <christian@spam.no> wrote:
>
> Place a "shebang" line at the top of your script such as:
>
> #!/usr/local/python
>
> ...though I'd double check to make sure the Python binary is
> actually at that location. Perhaps /usr/local/bin/python
>
> Then place the script in a directory on the server for which
> Apache has enabled ExecCGI. Make sure the script has
> a permissions (mode) setting of 755.
>
>
> A Python ML/NG would be a much better place to get help with
> this question.
>
> Tim Hammerquist


Thanks Tim, but I'm aware of the shebang thing and it works at my web hotel.
My problem though, is that Zope is a lot of .py scripts and is startet
by calling a shell script that calls a .py script.

And therefore I would like to configure Apache (in an .htaccess file) to
interpret the .py files as they are, without having to rename and to
place a shebang in all of them.
(And then replace the shell script that starts the whole thing with a
script that is called via the Internet from my web browser.)


Chris
Tim Hammerquist

2005-10-24, 4:44 pm

Christian <christian@spam.no> wrote:
> Tim Hammerquist wrote:
>
> Thanks Tim, but I'm aware of the shebang thing and it works at
> my web hotel. My problem though, is that Zope is a lot of .py
> scripts and is startet by calling a shell script that calls
> a .py script.


Without a working knowledge of Zope, I can't even know for sure
whether these multitude of Python files are called individually,
or if they are imported/included/dispatched from a central
program. If the former, you might be looking for
a ScriptAlias'd directory. If the latter, your work is a lot
simpler.

> And therefore I would like to configure Apache (in an
> .htaccess file) to interpret the .py files as they are,
> without having to rename and to place a shebang in all of
> them.
> (And then replace the shell script that starts the whole thing
> with a script that is called via the Internet from my web
> browser.)


I've never played with Zope, but I have a sneaking suspicion
that this might be beyond the capabilities granted you by the
server admin.

And again, you'd be better off checking in a python/zope
list/group/forum. I guarantee you you'll find more people there
with knowledge of installing/running zope in various
configurations... even on Apache... the most widely used httpd
in the world.

Tim Hammerquist
Christian

2005-10-24, 4:44 pm

Tim Hammerquist wrote:
> Christian <christian@spam.no> wrote:
>
> Without a working knowledge of Zope, I can't even know for sure
> whether these multitude of Python files are called individually,
> or if they are imported/included/dispatched from a central
> program. If the former, you might be looking for
> a ScriptAlias'd directory. If the latter, your work is a lot
> simpler.


Actually (if I understand you correct) it's the latter, and therefore I
also have to make some (well documented) changes in the configuration of
Apache, but that's piece of cake (I hope).
But does your answer imply that the solution is something like calling
the startup script (from a .cgi script) and that's it?

>
>
> I've never played with Zope, but I have a sneaking suspicion
> that this might be beyond the capabilities granted you by the
> server admin.


Well, you might be right but I'll give it a go. :-)

>
> And again, you'd be better off checking in a python/zope
> list/group/forum. I guarantee you you'll find more people there
> with knowledge of installing/running zope in various
> configurations... even on Apache... the most widely used httpd
> in the world.


The thing is that no matter how hard I've tryed I haven't found anything
about someone who has tried and succeeded nor about someone who has failed.


Never the less, Tim, thanks for your effort.

Chris
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com