472,993 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

Python web service ...

Hi folks, I have accomplished to make a python program that make some
image manipulation to bmp files.
I now want to provide this program as a web service. A user can visit a
site and through a web interface he should upload the file to the web
server , the server then will do the image process with the python
program I have wrote and when it finish the user must get the image
file back .

My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?

Aug 26 '06 #1
14 2979
On 26 Aug 2006 04:07:35 -0700, ni******@gmail.com <ni******@gmail.comwrote:
Hi folks, I have accomplished to make a python program that make some
image manipulation to bmp files.
I now want to provide this program as a web service. A user can visit a
site and through a web interface he should upload the file to the web
server , the server then will do the image process with the python
program I have wrote and when it finish the user must get the image
file back .

My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?
For a one-shot thing, plain old CGI might be enough. You can have a
static HTML page with the form for the upload, have python do the
image part, and generate the return HTML with the image with a python
script. If you plan to do this a lot, or want fairly sophisticated
stuff, or DB access underneath, authentication, etc, then you might
want to look at any of the web framewoks. If you don't have the web
server part already taken care of (e.g., you already have Apache up
and running) then the web server framework can be more attractive.

As for web frameworks there is a long list in the Python web site.
Which framework fits you best might depend on what you want to
accomplish now and in the future. You can try something simple and
minimalist (and with docs that you can read in less than an afternoon)
such as Karrigell, or try something more complex, such as Django,
TurboGears, Pylons, CherryPy, etc.

And then, you might try the CGI approach to begin with, and as your
needs become more complex, move to a framework. (This has been our own
path: we've used plain CGI for over a year for the web-based
bioinformatics applications we've developed, that use R and Python for
computations, and are now moving to framework).

Good luck!

R.

--
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Aug 26 '06 #2
For a one-shot thing, plain old CGI might be enough. You can have a
static HTML page with the form for the upload, have python do the
image part, and generate the return HTML with the image with a python
script. If you plan to do this a lot, or want fairly sophisticated
stuff, or DB access underneath, authentication, etc, then you might
want to look at any of the web framewoks. If you don't have the web
server part already taken care of (e.g., you already have Apache up
and running) then the web server framework can be more attractive.

As for web frameworks there is a long list in the Python web site.
Which framework fits you best might depend on what you want to
accomplish now and in the future. You can try something simple and
minimalist (and with docs that you can read in less than an afternoon)
such as Karrigell, or try something more complex, such as Django,
TurboGears, Pylons, CherryPy, etc.

And then, you might try the CGI approach to begin with, and as your
needs become more complex, move to a framework. (This has been our own
path: we've used plain CGI for over a year for the web-based
bioinformatics applications we've developed, that use R and Python for
computations, and are now moving to framework).

Good luck!

R.

--
Ramon Diaz-Uriarte
At this time right now I prefer to do something that works the quickest
possible...
I never had any experience with CGI, do I need to set up a web server
for that ?
can you point me some usefull reading material so I can get a start ?
I will post for a comment at Zope , I had installed once and it was
very easy. Don't know if it will be easy too to get my job done...

Gracias Ramon.

Aug 26 '06 #3
At this time right now I prefer to do something that works the quickest
possible...
I never had any experience with CGI, do I need to set up a web server
for that ?
can you point me some usefull reading material so I can get a start ?
I will post for a comment at Zope , I had installed once and it was
very easy. Don't know if it will be easy too to get my job done...
If you need a quick-start and short learning curve, Karrigell is the
one to go for. You can have the beginnings of your own site/web-app
running within minutes of downloading it.

It now has better CGI handling too - if you must go that route :)

www.karrigell.com

I recommend the Karrigell tour also, click on the icon next to each
example to see how each one is coded, and it has a file upload example
that should get you started.

http://karrigell.no-ip.info/demo/frame_tour_en.htm

:)
Aug 26 '06 #4

Tim Williams wrote:
At this time right now I prefer to do something that works the quickest
possible...
I never had any experience with CGI, do I need to set up a web server
for that ?
can you point me some usefull reading material so I can get a start ?
I will post for a comment at Zope , I had installed once and it was
very easy. Don't know if it will be easy too to get my job done...

If you need a quick-start and short learning curve, Karrigell is the
one to go for. You can have the beginnings of your own site/web-app
running within minutes of downloading it.

It now has better CGI handling too - if you must go that route :)

www.karrigell.com

I recommend the Karrigell tour also, click on the icon next to each
example to see how each one is coded, and it has a file upload example
that should get you started.

http://karrigell.no-ip.info/demo/frame_tour_en.htm

:)
I second Karrigell on simplicity. Zope despite recent improvements,
still has a steep learning curve.

Aug 26 '06 #5
My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?
Just install Apache and run Python as CGI thats the best solution I
found for my apps. Thats the best and faster way to move python apps on
web.

Aug 26 '06 #6
On 26 Aug 2006 09:12:50 -0700, NicolasG <ni******@gmail.comwrote:
For a one-shot thing, plain old CGI might be enough. You can have a
static HTML page with the form for the upload, have python do the
image part, and generate the return HTML with the image with a python
script. If you plan to do this a lot, or want fairly sophisticated
stuff, or DB access underneath, authentication, etc, then you might
want to look at any of the web framewoks. If you don't have the web
server part already taken care of (e.g., you already have Apache up
and running) then the web server framework can be more attractive.

As for web frameworks there is a long list in the Python web site.
Which framework fits you best might depend on what you want to
accomplish now and in the future. You can try something simple and
minimalist (and with docs that you can read in less than an afternoon)
such as Karrigell, or try something more complex, such as Django,
TurboGears, Pylons, CherryPy, etc.

And then, you might try the CGI approach to begin with, and as your
needs become more complex, move to a framework. (This has been our own
path: we've used plain CGI for over a year for the web-based
bioinformatics applications we've developed, that use R and Python for
computations, and are now moving to framework).

Good luck!

R.

--
Ramon Diaz-Uriarte

At this time right now I prefer to do something that works the quickest
possible...
I never had any experience with CGI, do I need to set up a web server
for that ?
Yes, you'd need to configure a web server. I don't know whether you
are on windows or Unix/Linux, and that could seriously affect how easy
it is to set up a web server. Most Linux distros make installing
apache a piece of cake, but configuring Apache might not be trivial.

Thus, maybe the fastest and easiest is, as other posters have
suggested, to try Karrigell.

can you point me some usefull reading material so I can get a start ?
I will post for a comment at Zope , I had installed once and it was
very easy. Don't know if it will be easy too to get my job done...
But Zope seems to have a steep learning curve and it is a big system.
It might be a huge hassle for what you want.

Best,

R.
Aug 26 '06 #7

ni******@gmail.com wrote:
My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?
I also second the suggestion of using Karrigell.
It comes with its own built-in server, and the task would be as simle
as writing the script and starting the server.

If performance and scalability is an issue, you could try mod_python,
which is an Apache module for running python, but this would require
installing and configuring Apache and mod_python separately.

luis

Aug 27 '06 #8
ni******@gmail.com a écrit :
Hi folks, I have accomplished to make a python program that make some
image manipulation to bmp files.
I now want to provide this program as a web service. A user can visit a
site and through a web interface he should upload the file to the web
server , the server then will do the image process with the python
program I have wrote and when it finish the user must get the image
file back .

My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?
Unless you have other compelling reasons to use Zope, you would be
better IMHO with either CGI, apache+mod_python, or a standalone Python
web server like CherryPy.

Aug 28 '06 #9
On 26 Aug 2006 04:07:35 -0700, ni******@gmail.com <ni******@gmail.comwrote:
Hi folks, I have accomplished to make a python program that make some
image manipulation to bmp files.
I now want to provide this program as a web service. A user can visit a
site and through a web interface he should upload the file to the web
server , the server then will do the image process with the python
program I have wrote and when it finish the user must get the image
file back .

My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?
is that webservice or webserver?
if webservice try ZSI of it's a webserver why don't you try CherryPy?
>
--
http://mail.python.org/mailman/listinfo/python-list
Aug 28 '06 #10
If I want to run my program as a web service I need to setup a
webserver , am I right ?
Whars that difference ? can a webservice be run without a webserver ?

On 8/29/06, Jorge Vargas <jo**********@gmail.comwrote:
On 26 Aug 2006 04:07:35 -0700, ni******@gmail.com <ni******@gmail.comwrote:
Hi folks, I have accomplished to make a python program that make some
image manipulation to bmp files.
I now want to provide this program as a web service. A user can visit a
site and through a web interface he should upload the file to the web
server , the server then will do the image process with the python
program I have wrote and when it finish the user must get the image
file back .

My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?

is that webservice or webserver?
if webservice try ZSI of it's a webserver why don't you try CherryPy?

--
http://mail.python.org/mailman/listinfo/python-list

--
Nicolas G

mobile: +30 69 45 714 578
Aug 28 '06 #11
At Monday 28/8/2006 20:45, Nicolas G wrote:
>If I want to run my program as a web service I need to setup a
webserver , am I right ?
Whars that difference ? can a webservice be run without a webserver ?
Well, a webservice uses HTTP as its transport protocol, so you need
an HTTP server, but you don't have to use a full-blown web server to
implement it. SimpleHTTPServer

in the standard library may be enough.

Gabriel Genellina
Softlab SRL

__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Aug 29 '06 #12
You mean to use only python HTTP socket library ?
I never had use sockets before, it has a big learning curve ?
Gabriel Genellina wrote:
At Monday 28/8/2006 20:45, Nicolas G wrote:
If I want to run my program as a web service I need to setup a
webserver , am I right ?
Whars that difference ? can a webservice be run without a webserver ?

Well, a webservice uses HTTP as its transport protocol, so you need
an HTTP server, but you don't have to use a full-blown web server to
implement it. SimpleHTTPServer

in the standard library may be enough.

Gabriel Genellina
Softlab SRL

__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
Aug 30 '06 #13
NicolasG wrote (top-posting, which is very naughty ...):
>>At Monday 28/8/2006 20:45, Nicolas G wrote:

>>>If I want to run my program as a web service I need to setup a
webserver , am I right ?
Whars that difference ? can a webservice be run without a webserver ?

Well, a webservice uses HTTP as its transport protocol, so you need
an HTTP server, but you don't have to use a full-blown web server to
implement it. SimpleHTTPServer

in the standard library may be enough.
You mean to use only python HTTP socket library ?
I never had use sockets before, it has a big learning curve ?
Gabriel Genellina wrote:
He's actually suggesting you use the SimpleHTTPServer library, which
itself uses the socket library. All you really need to do is subclass
the main clas defining your own (?) handle_request() (?) method.

This server is not design for industrial-strength networking but it's
fine if you need either a low-volume server or something to experiment with.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Aug 30 '06 #14
At Wednesday 30/8/2006 07:25, NicolasG wrote:
>You mean to use only python HTTP socket library ?
I never had use sockets before, it has a big learning curve ?
>If I want to run my program as a web service I need to setup a
>webserver , am I right ?
>Whars that difference ? can a webservice be run without a webserver ?
Well, a webservice uses HTTP as its transport protocol, so you need
an HTTP server, but you don't have to use a full-blown web server to
implement it. SimpleHTTPServer in the standard library may be enough.
You don't need to know about sockets more than you need to know how a
diesel engine works in order to drive a car.
A webservice *uses* HTTP as a transport protocol - any HTTP server would do.

PS: Top posting is not a good idea...

Gabriel Genellina
Softlab SRL

__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Aug 30 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nazgul | last post by:
Hi! Sorry if I posted it twice... I need your help... I have the following problem. I've implemented the python Windows Service which behaves like a log supervisor. If the space used by log...
0
by: David Mitchell | last post by:
Hello group, I'm trying to create a TCP server using Python, and I want it to run under Windows as a service. Now, I'm fine with building the TCP server using Python - done it lots of times,...
3
by: David Fraser | last post by:
Hi We are trying to debug a problem with services created using py2exe. It seems that these problems have arisen after services were installed and removed a few times. OK, first the actual...
0
by: Saravanan | last post by:
Hello, Im using Python 2.3.3 along with Win32all (163). Currently my python application runs as Windows Service. Im using Win32all Service Framework to run the Python Code as a Windows Service....
3
by: zxo102 | last post by:
Hi there, I have a python application (many python scripts) and I start the application like this python myServer.py start in window. It is running in dos window. Now I would like to put it...
22
by: flit | last post by:
Hello All, I have a hard question, every time I look for this answer its get out from the technical domain and goes on in the moral/social domain. First, I live in third world with bad gov., bad...
1
by: Aspersieman | last post by:
Hi All I have a windows service (attached file). I basically just calls another script every 60 seconds. I can install, start and stop this service as expected with: ParseMailboxService.py...
3
by: David Moss | last post by:
Hopefully a service like this already exists and I just haven't found it yet. If not it could be an idea for some kind soul(s) to pick up and run with ;-) As someone who writes and releases...
2
by: Gabriel Rossetti | last post by:
Hello everyone, I'm trying to use python's freeze utility but I'm running into problems. I called it like this : python /usr/share/doc/python2.5/examples/Tools/freeze/freeze.py...
2
by: Guilherme Polo | last post by:
On 10/29/08, Zix <saviourms@yahoo.co.inwrote: Why did you decide to "expose" a web service through xmlrpc instead of actually exposing it by using a restful web service ? The links pointed by...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.