[Tutor] Webinterface for python script

2019-01-30 Thread Asad
Hi All ,

  I have created certain python scripts to analyze log files and
suggest solution based on logic which I invoke on the command line . I need
some information on how to execute these through browser . I am using :

python test.py file1 file2

How do I use the browser to upload the files file1 and file2 and it process
the files .

Please advice ,

Thanks,



--
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Webinterface for python script

2019-01-30 Thread Joel Goldstick
On Wed, Jan 30, 2019 at 11:20 AM Asad  wrote:
>
> Hi All ,
>
>   I have created certain python scripts to analyze log files and
> suggest solution based on logic which I invoke on the command line . I need
> some information on how to execute these through browser . I am using :
>
> python test.py file1 file2
>
> How do I use the browser to upload the files file1 and file2 and it process
> the files .
>
> Please advice ,
>
> Thanks,
>
Django may be overkill, but there is a large support community.  There
are other smaller web frameworks, flask is one I can recall.  There is
a learning curve, but once you get past that, you could do this in a
couple days


-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Webinterface for python script

2019-01-30 Thread Alan Gauld via Tutor
On 30/01/2019 14:06, Asad wrote:

>   I have created certain python scripts to analyze log files and
> suggest solution based on logic which I invoke on the command line . I need
> some information on how to execute these through browser . I am using :
> 
> python test.py file1 file2
> 
> How do I use the browser to upload the files file1 and file2 and it process
> the files .

It's not clear how you think this will work.
You say 'upload the files through a browser'.
Where do you want to upload them too?
Do you have a web server somewhere or can you
set one up?

If so then you need to write a web application
to select the local files from the users PC and
upload them to the server. Once you have that, you
can call your Python script on the server and
display the output as HTML back on the users browser.

To do that will probably involve changes to your
existing code to make it callable as a function and
to have the output displayable as HTML.

There are many web frameworks you can use and for
this type of project any of them will suffice.
There is a page summarising the most common here:

https://wiki.python.org/moin/WebFrameworks/

I recommend Flask and you can see a short tutorial
on its use in my tutor under the topic "Using Web App Frameworks."
There are several other, more in-depth, tutorials
if you think its for you.

For the browser specific bits you can probably find
all the code you need via Google...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor