Questions tagged [web2py]

web2py is a open-source full-stack web framework written in Python.

web2py is a free, open-source web framework for agile development of secure database-driven web applications; it is written in Python.

web2py is a full-stack framework. It includes an ORM (called the Data Abstraction Layer), its own template engine and typical form widget helpers and controls.

Created by a team of professionals and academics, one of its key principles is no backward incompatible changes. Development is led by Massimo Di Pierro, Associate Professor in Computer Science at DePaul University in Chicago.

Additional resources:

  1. Project Website
  2. Documentation
  3. Source Code
  4. Sample Websites
  5. Wikipedia Page
  6. Google Group

Simple Example (from What is web2py?):

Model Definition:

db=DAL('sqlite://storage.db')
db.define_table('image', 
    Field('name'),
    Field('file','upload'))

Controller:

def index():
    form = SQLFORM(db.image)
    if form.process().accepted:
        response.flash = 'image uploaded'
    return dict(form = form,counter=None,_class='boxCode')

View:

{{extend 'layout.html'}}
<h1>Image upload form</h1>
{{form}}
2141 questions
4
votes
2 answers

web2py - test for row with combination of two field values

I'm building a web2py controller in which I need to query a table for a combination of value x in one field AND value y in a second field (in the same row). To query on a single field, I would just write db.table.field == x But I don't know how to…
monotasker
  • 1,985
  • 1
  • 17
  • 22
4
votes
2 answers

web2py TypeError: id() takes exactly one argument (0 given)

I am making a web service in Web2Py which accept some parameters and inserts them into a table. I am getting the following error while I am inserting data in this 1 table Traceback (most recent call last): File…
Mus
  • 1,860
  • 2
  • 16
  • 19
4
votes
2 answers

Python framework for REST API on top of a C++ application

I am developing a C++ application, which is basically a trading engine. The trading engine will have two front-ends, a Qt C++ based application running on a desktop and a web application. Architecturally, I think it makes sense to have a layer REST…
Lazylabs
  • 1,414
  • 16
  • 23
4
votes
5 answers

What are the relative advantages of various Python/PHP web frameworks (particularly for my project)?

I'm deciding on a web framework for an upcoming project, and I'd appreciate any advice. We've decided to use jQuery for the JavaScript, and are heavily leaning toward Python or PHP (more Python) for our server-side logic. I'm especially interested…
Aaron
  • 2,049
  • 4
  • 28
  • 35
4
votes
1 answer

How to encapsulate web2py business logic?

I just found web2py a couple days ago, and have been reading the documentation and through the source of a few example applications. I want to start programming more in Python. It seems that my take on MVC is a little skewed from theirs [web2py…
BDuelz
  • 3,890
  • 7
  • 39
  • 62
4
votes
2 answers

web2py: detect change in dropdown widget

How can we detect a change from a dropdown widget so that code can be executed? Table loan references table services. Both have field called interest_rate. When I change loan.service via dropdown I'd like to reflect the corresponding interest_rate…
JeffP
  • 539
  • 1
  • 5
  • 19
4
votes
2 answers

web2py: drop all tables in a database in one statement?

I was wondering if web2py offers any way to drop all tables at once, without having to specify each table to be deleted? Thanks in advance!
Andrei
  • 71
  • 1
  • 3
4
votes
1 answer

Uploading a simple web2py app to GAE

I created a web2py app that is extremely light, with the goal of eventually making the app support JSON-RPC calls, and maybe a few other things. I found some tutorial online that (on winxp) had me get the source code for web2py and extract it on top…
Charles L.
  • 5,795
  • 10
  • 40
  • 60
4
votes
1 answer

customizing size of form fields created using field.custom.widget

I used the following code to generate a form in attached image. Is it possible to change the size of the fields in the form. I want to decrease size of input field of Estimated time and the dropbox field to the right of…
sahil
  • 1,108
  • 3
  • 15
  • 25
4
votes
2 answers

web2py redirect to previous page

When from a page , I goto another page via some hyperlink,is there any way to go back to the previous page. The previous page has some arguments also. SO I want to ask whether the previous page is saved somewhere or is there any other way to go…
sahil
  • 1,108
  • 3
  • 15
  • 25
4
votes
2 answers

Python try except finally

It looks like I don't quite have the hang of Exception handling yet. I'm at a loss :( The following code sometimes returns this error: File "applications/pingback/modules/plugin_h_pingback.py", line 190, in ping …
hcvst
  • 2,665
  • 2
  • 22
  • 25
4
votes
1 answer

web2py: Where should I store private, application-specific files?

I have just started working on web2py. Personally, I find it easier to learn than Django. My query is that I have to load a file at application startup. Its a pickled hashtable. Where should I store this file so that the system is able to see it My…
Sudeep
  • 43
  • 4
4
votes
1 answer

library of react components in webpack bundle export to use in on runtime rendering

I am upgrading a legacy web2py (python) application to use react components. I am using webpack to transpile the jsx files to minified js bundle. I want to be able to use: ReactDOM.render( , …
Anima-t3d
  • 3,431
  • 6
  • 38
  • 56
4
votes
3 answers

Images not loading and not displaying on HTML canvas

I am working on a website that, when loaded, it displays the compiled image from an HTML canvas element. My problem is that I can't tell when an image is loaded to draw it to the canvas or how to force an image to be loaded before I proceed to the…
nightwuffle
  • 311
  • 3
  • 10
4
votes
2 answers

Is code interpreted at every call in Web2Py?

If so, What is the advantage ? (sure it will avoid restarting webserver). But isn't it a perfomance bottleneck? For production, is it possible to make web2py run directly from bytecode skipping interpreting stage (Caching) (except for the first…
Stanley
  • 41
  • 2