Hello Mr.pallavi, Mr.George and other members,
I have similar application like palavi. I followed this hints but not
success.
Please let me know how did you proceed.

my python application has functions to perform different
calculations.

1) The program reads input file called IN.txt.
the IN.txt file contains names of three other files( x.dat, y.txt,
z.dat) that are
in the same directory.

2) then the application reads the data in the files x.dat, y.txt,
z.dat and performs some calculations.

3) outputs the results in a file called out.txt

The application is running perfectly from command mode. I need to make
it a web application so that it can be run in a browser from anywhere.
I tried with cherrypy and django tutorials, but could not succeed, as
i am completely new to this field. can some one help with steps to
proceed.

Thanks in advance!
Susanne

> My main python program is science.py
> it have several modules.in it (each definition reads some parameters
> and results some data, that will be read
> by next module). but at the end, only few of the results are printed
> to a data file.


> science.py
> ---------------
> def function1(parameter1,parmeter2) :
>                   {
>                        -----
>                        -----
>                   }
>                   return data1


> def function2(data1,parmeter3) :
>                   {
>                        -----
>                        -----
>                   }
>                   return data2


> #output is printed to a file as data.dat that contains data1, data2


> view.py
> ------------
> from django.http import HttpResponse
> from science import function1
> from science import function2


> def science_service(request):
>          return HttpResponse(
>          # function1 reads parameter1, and parameter2
>          function1 (parameter1, parameter2), , mimetype="text/plain"
>          )


> def science_service(request):
>          return HttpResponse(
>          function2 (data1, parameter3), , mimetype="text/plain"
>          )


> is this the correct way to write my view based on George's
> suggestion:
> i keep my science.py in the current working directory.
> pls shed some light....your suggestions are very valuable for novice
> like me.



You're on the right track.

1. You can't name both views the same, if they're in the same module.
Otherwise the second definition will override the first one.
2. There's a slight mistake in your response:
{{{
def science_service(request):
     return HttpResponse(
         function1(p1, p2), mimetype="text/plain"
     )



}}}


Of course you'll have to instantiate p1 and p2 somewhere in the
module,
if you're not passing those in through the request somehow.

--
George



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to