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

How do I get list of field objects in a table in web2py?

How do I get a list of all the field objects (e.g. gluon.dal.Field) in a table? The following db.customer.fields just returns a list of strings which are the field names.
User
  • 62,498
  • 72
  • 186
  • 247
4
votes
1 answer

Where does Web2py save project files OS X?

I am pulling my hair out trying to figure out where web2py stores the project files by default in OS X. It is not located in the same directoy as the web2py.app . I can launch the web interface and see project in the admin view but want to edit the…
bmartinek
  • 568
  • 2
  • 6
  • 17
4
votes
1 answer

How to pass a JSON object to web2py using JQuery Ajax

I've used this method in .NET to pass data back and forth between client and server using JSON objects (both ways). I really liked the method and am looking to do something similar with web2py. Web2py supports returning json objects and supports…
srmark
  • 7,942
  • 13
  • 63
  • 74
4
votes
1 answer

Opening a text file from the private folder in web2py

I need to open a database (in .txt format) for my search engine script in web2py. I can not access the online database, because I use the free version of pythonanywhere. import urllib infile=urllib.urlopen('http://database.net') for line in…
user2377757
  • 41
  • 1
  • 2
4
votes
1 answer

How to decrease the timeout for my python application connecting to mysql server

We have a python application running with uwsgi, nginx. We have a fallback mechanism for DBs. ie., if one server refuses to connect, we connect to the other server. But the issue is that the connection takes more than 60s to timeout. As nginx times…
Srinath G S
  • 155
  • 6
  • 14
4
votes
1 answer

Web2py Custom Validators

I am new to Web2py and am trying to use a custom validator. class IS_NOT_EMPTY_IF_OTHER(Validator): def __init__(self, other, error_message='must be filled because other value ' 'is present'): …
Rahul Bhatia
  • 1,005
  • 2
  • 13
  • 18
4
votes
0 answers

'urllib2.URLError'(

I have a web2py app installed which is served by Apache. After months of successful deployment, the website suddenly stops functioning with the error: class 'urllib2.URLError'(urlopen error [Errno -3] Temporary failure in name resolution) I tried…
Saurabh Kumar
  • 195
  • 3
  • 12
4
votes
2 answers

web2py inline editable grid

I'm using web2py to build a dynamic web UI to a MySQL backend, and I'm new to the web2py framework and web development in general. What I'm looking for is a library or plug-in with the following features that is either built for or compatible with…
Eric S.
  • 320
  • 2
  • 11
4
votes
2 answers

How do I install web2py in a virtualenv in Windows 7?

I'm new to Python and I'm trying to install web2py in a virtualenv. I'm running a 32 bit python 2.7.3 installation on a 64 bit Windows 7. From what I read, this should be the process: install virtualenv (done) create the virtualenv (done) install…
bernardo.g
  • 826
  • 1
  • 12
  • 27
4
votes
1 answer

Web2py - how to create popup window?

What is the preferred way to create a popup window in web2py? For example, let's say you want to pop up a Terms of Service box, and have the user click that he agrees with the terms before allowing the user to proceed - what would be a good way to…
Lamps1829
  • 2,231
  • 3
  • 24
  • 32
4
votes
1 answer

Formatting date in Web2py Python

I'm looking for a function to format a date in order to get day, month and year. Dates are being stored in my database in the following format 2012-09-26.
Agustin.Ferreira
  • 311
  • 1
  • 3
  • 11
4
votes
2 answers

how to add new fonts to pyfpdf

i've tried to copy a dejavucondensed.ttf into pyfpdf/font/ But no luck when i tried >>> from pyfpdf import * >>> p = FPDF() >>> p.add_font('dejavucondensed') SyntaxError: Non-ASCII character '\xfd' in file pyfpdf/font/dejavucondensed.font on line…
adesst
  • 297
  • 3
  • 7
3
votes
1 answer

how to create, insert and update database table using web2py?

I am new to python and web2py development. My requirement is : I have to create one html page which consists Employee information for e.g. employee Name, Age, Address etc... and buttons will be there Save, Refresh ..after entering Employee info to…
piks
  • 1,621
  • 8
  • 32
  • 59
3
votes
3 answers

Storing Configuration details

I have a bunch of string and integer constants that I use at various places in my app. I am planning to put them up in a centralized location, so that it is easier to change them in the future. I could think of the following approaches: 1) Have them…
S P
  • 1,801
  • 6
  • 32
  • 55
3
votes
3 answers

Can I include partial view in Web2Py, passing specific variables into it?

I sometimes need to use partial views in Web2Py, but I need to pass some specific variables to them. In Django it would look like this: {% include "image.html" with caption="Me" source="http://example.com/img.png" %} In case of Web2Py I can do…
Tadeck
  • 132,510
  • 28
  • 152
  • 198