Is Web2py suitable for my project

418 views
Skip to first unread message

Eric

unread,
Jan 24, 2015, 11:23:22 AM1/24/15
to web...@googlegroups.com
Hi all,

I'm new to web2py and have been working my way through the learning materials. I have a specific application and am wondering if web2py is a good choice for a framework or something simpler such as Flask. Specifically I want to create a web application (for an intranet) where a user would upload a data file using the standard browser file dialog, have it analyzed by an algorithm I've written in Python and then responses plotted on the page and also a file of results savable using the browsers standard save file dialog. I know enough Python to handle the file parsing, data analysis and result file generation. I'll need access to Python libraries such as Numpy. I've discovered Bokah (http://bokeh.pydata.org) as an attractive plotting library. They use Flask in their tutorial. I haven't found anything particularly clear about how to invoke the browser file dialogs. Eventually I'd like to use a database to archive the uploaded data files and resulting result files along with other information such as user, date, instrument serial number, etc.

Thanks,

Eric

Kiran Subbaraman

unread,
Jan 25, 2015, 4:24:18 AM1/25/15
to web...@googlegroups.com
I would use web2py for these requirements, because you get the authentication/authorization, sessions, DAL (for db access) capabilities out of the box.
You probably need packages in addition to pydal (for DAL support), on top of Flask to accomplish this. Look at the gluino example to see what I mean: https://github.com/mdipierro/gluino
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric

unread,
Jan 25, 2015, 4:52:11 PM1/25/15
to web...@googlegroups.com
Kiran,

Thanks for the response. I'm extremely new to any sort of web programming. I have a bit of Python experience. Unfortunately the response above was simply above my head. I've written file parsers in Python so I can handle that. I'm confident I can write the algorithms too. What I can't figure out is how to integrate a plotting utility like Bokeh or possibly MPLD3 (http://mpld3.github.io/index.html) into Web2py and get the plot to show up in a Web2py created page. I've seen a few examples of how to trigger a browser's file dialog, but don't know how to use that to get a file into the Python parsing script. I'm usually pretty good at finding resources on the web, but my general knowledge of web technologies is a problem.

Eric

Massimo Di Pierro

unread,
Jan 25, 2015, 8:51:45 PM1/25/15
to web...@googlegroups.com
I would not recommend gluino at this time (even if I wrote it) because it was an experiment it is not clear where it is going. If you want Flask for DAL look into https://github.com/gi0baro/weppy

Anyway, web2py, Flask and weppy are all good choices. Web2py offers you the web IDE, the builtin authentication, and more automated form logic.

Kiran Subbaraman

unread,
Jan 25, 2015, 10:43:52 PM1/25/15
to web...@googlegroups.com
Eric,
The best option then is for you to try out the "hello-world" example in web2py. This will give you a good idea as to how to create a minimal web application, and also insert your code. You need to start here: http://web2py.com/books/default/chapter/29/03/overview#Say-hello
The stuff you are talking about should be pretty straight-forward in web2py (or any other equivalent web framework).
You need to create a model file (to store stuff in the db), a controller (where your plotting logic, like that of Bokeh / MPLD3, will reside), and the view (the html where you render your charts, or even embed javascript based plotting libraries - like d3js).
Feel free to ask questions as you work your way through the initial web2py programming model.
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/

Richard Vézina

unread,
Jan 26, 2015, 10:30:48 AM1/26/15
to web2py-users
Didn't know bokeh thanks!

Richard

Eric

unread,
Jan 26, 2015, 10:58:57 AM1/26/15
to web...@googlegroups.com
Richard,

If you try Bokeh and/or mpld3 please tell me how it went. I'll need scientific plots in my application and would welcome any hints on how to accomplish this in Web2py.

Eric

Richard Vézina

unread,
Jan 27, 2015, 10:53:00 AM1/27/15
to web2py-users
I will probably try, but not soon...

I am really currious to know how it works and can provide that kind of feature, maybe it is similar to Brython (http://www.brython.info/)...

Richard

Eric's Gmail

unread,
Jan 27, 2015, 12:14:39 PM1/27/15
to web...@googlegroups.com
Richard,

I think Bokeh and MPLD3 are quite specifically designed to provide somewhat interactive scientific plots. Brython seems completely different.

Eric

- Eric



You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/moYhW9ydpyA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Richard Vézina

unread,
Jan 27, 2015, 1:51:34 PM1/27/15
to web2py-users
Eric,

Have you consider IPython?

It is less appealing then the stack you are talking, but may be a fast solution that can fill in some of you needs...

Richard

Richard Vézina

unread,
Jan 27, 2015, 1:51:52 PM1/27/15
to web2py-users
I mean IPython notebook...

Eric's Gmail

unread,
Jan 29, 2015, 9:47:44 AM1/29/15
to web...@googlegroups.com
Richard,

The users are biologists and chemists so any sort of “programming” is too much.

Eric

Richard Vézina

unread,
Jan 29, 2015, 11:44:01 AM1/29/15
to web2py-users
:D

I know that... Though I am biologist too 

:)

There is biologist that like coding...

Richard

Matthew J Watts

unread,
Nov 25, 2017, 6:53:08 AM11/25/17
to web2py-users
Hi Eric

Did you end up using web2py for this project?

Like you i'm a Biologist trying to use Web2py by to query, process and visualize data, I was wondering if you could show me an example of how you integrated Bokeh into web2py

Thanks

Matt

Leonel Câmara

unread,
Nov 28, 2017, 12:22:15 PM11/28/17
to web2py-users
I am not really a biologist or use bokeh. But looking at their documentation it looked pretty simple. So I decided to try it. Here's a simple example.

This is your controller function

def index():
   
from bokeh.plotting import figure
   
from bokeh.embed import components
   
# prepare some data
    x
= [1, 2, 3, 4, 5]
    y
= [6, 7, 2, 4, 5]
   
# create a new plot with a title and axis labels
    p
= figure(title="simple line example", x_axis_label='x', y_axis_label='y')
   
# add a line renderer with legend and line thickness
    p
.line(x, y, legend="Temp.", line_width=2)
    script
, div = components(p)
   
return {'bokeh_script': script, 'bokeh_div': div}

This is the index.html view you would use to show the graph made in the controller
 
{{extend 'layout.html'}}

{{block head}}
<link href="http://cdn.pydata.org/bokeh/release/bokeh-0.12.10.min.css" rel="stylesheet" type="text/css">
<link href="http://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.10.min.css" rel="stylesheet" type="text/css">
<script src="http://cdn.pydata.org/bokeh/release/bokeh-0.12.10.min.js"></script>
<script src="http://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.10.min.js"></script>
{{response.write(bokeh_script, escape=False)}}
{{end}}

{{response.write(bokeh_div, escape=False)}}




Eric's Gmail

unread,
Nov 30, 2017, 7:40:30 PM11/30/17
to web...@googlegroups.com
Matt,

Sorry to say that the project never progressed so I can’t help you with web2py and Bokeh.

Eric

Matthew J Watts

unread,
Dec 1, 2017, 6:02:16 AM12/1/17
to web...@googlegroups.com
great, thanks for your help Leoanal. I will give it a go!

and thanks for your response Eric. 

I'll post the results of my work here in case anyone needs it in the future

cheers

Matt


Eric

To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/moYhW9ydpyA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages