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
3
votes
2 answers

web2py and wordpress on lighttpd

I have python web2py installed on lighttpd server, but i want to add wordpress for blogging, the problem is i want wordpress to be on site.com/blog not as subdomain, How can i manage lighttpd configuration to run! url.rewrite-once = ( …
Omiga
  • 572
  • 3
  • 11
3
votes
3 answers

How to run web2py project on Apache server?

I want to develop my project with web2py. Before that I make it with python cherrypy. and now going to switch to web2py. But I would like use Apache server instead of WSGI and web2py server! Could you guide me how do this?
NrNazifi
  • 1,621
  • 3
  • 25
  • 36
3
votes
1 answer

web2py - remove blank option from IS_IN_DB validator

In web2py, say I have modified the default auth_user table by adding a field called 'agent_code'. This field should include values from another table: auth_table = db.define_table( auth.settings.table_user_name, Field('first_name',…
nerfologist
  • 761
  • 10
  • 23
3
votes
1 answer

Web2py authorization with CAS ( central authentication service )

I have several applications, all of them are web2py-based, I want all of them to use a central authentication service, CAS in web2py is working properly for authentication, but when it comes to authorization, it is not working ! let's say we have…
3
votes
3 answers

How can I set the syntax colour inside delimiters in Emacs?

I have a HTML file, and I’m using python code inside curly braces (web2py templates), something like {{for i in range something:}} {{=i.name}} {{pass}} inside the body of a file with a .html extension. My question is, How can I change the colour…
deadPoet
  • 528
  • 9
  • 22
3
votes
1 answer

Get all logged in Users Web2py

Is there a quick and simple way to get all the users that are currently logged in to a web2py application? I would like to show the administrator of the page how many non-admin users are logged in at the moment. Thanks..
3
votes
2 answers

Processing ember.js tagged html with python

I have the following scenario: We are using web2py in the server side We are serving some ember.js pages Currently those ember.js pages are inside an iframe, because ember.js and web2py conflict with template {{ }} marks. That means we can not…
blueFast
  • 41,341
  • 63
  • 198
  • 344
3
votes
1 answer

Stream a couchdb attachment with web2py

I have some sound files in a couchdb database (not related to web2py). My web2py application has access to this database, and I want to stream the sound files so that they can be listened with the HTML audio tag, like this:
blueFast
  • 41,341
  • 63
  • 198
  • 344
3
votes
5 answers

web2py doesn't recognize modules in the modules directory

I copied a module to the "modules" folder of the application in web2py. When I tried to import the module in any function inside of any of the controllers, I get the following error: No module named module_name I get…
SUB0DH
  • 5,130
  • 4
  • 29
  • 46
3
votes
1 answer

Accessing module installed on Pythonanywhere in Web2py

I've used pip-2.7 install --user soundcloud to install the soundcloud module for Python 2.7 in Pythonanywhere. In my Web2py App in Pythonanywhere, I get an error message when using import soundcloud, stating that the soundcloud module does not…
mrl
  • 1,467
  • 2
  • 14
  • 22
3
votes
1 answer

Many-to-many relationship in web2py

I have a table of articles in my web2py project similar to this one: db.define_table('articles', Field('created_on', 'datetime', default = datetime.today(), required = True, notnull = True, …
3
votes
1 answer

Web2py: Custom CSS class for custom form

How do i specify the class of a custom web2py form? for e.g. {{=form.custom.begin}} Image name:
{{=form.custom.widget.name}}
Image file:
{{=form.custom.widget.file}}
Click here to upload:…
gibraltar
  • 1,678
  • 4
  • 20
  • 33
3
votes
1 answer

web2py How lo log out a user

I have just started looking at web2py, so many things in the approach are nwe, such as the use of defaults for views etc. I spent many hours trying to figure out how to get people to log in and in the end put @auth.requires_login() at the start of…
jimscafe
  • 1,081
  • 2
  • 14
  • 24
3
votes
1 answer

Need help understanding module import errors

I'm trying to use the sendgrid Python API as a module in web2py. After testing it successfully from the command line, I dropped it into my modules folder, but as soon as I try to import sendgrid into my controller file, I get: File…
Yarin
  • 173,523
  • 149
  • 402
  • 512
3
votes
3 answers

is it possible to have two submit button for one form?

I am using web2py to write a search engine like app. Is it possible to implement two submit button for one form such as google has two buttons "search" and "I am feeling lucky". Thanks in advance.
Treper
  • 3,539
  • 2
  • 26
  • 48