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
0
votes
1 answer

Execute a python script in web2py controller

I'm trying to execute a Python script stored in the 'private' folder of a web2py application. My code, in the index() function of the default.py controller import os def index(): fp = os.path.join(request.folder, 'private', 'runscrape.py') …
murty
  • 145
  • 1
  • 6
0
votes
1 answer

Web2py, multiple Ajax calls and session variables stored in MySQL

In order for a progress bar using cache.ram, and an ajax call to work properly, there is a need to clean (or just unlock?) sessions. If the app doesn't use session variables to pass to other controllers then session.forget(response) is…
Toren
  • 442
  • 3
  • 13
0
votes
1 answer

Create list of web2py links using javascript

I have an object in the javascript which contains id, name pairs which identify entries in my web2py 'projects' table. In the browser, I populate the view with the entries using python {{=A('+ Create New Project',…
Raul M
  • 124
  • 6
0
votes
0 answers

Can't set column widths using datatables in web2py app

I have used DataTables in several web2py apps with little trouble (after the learning curve), but I am working on a new app and cannot seem to get the columnDefs to set the column widths. Here is the javascript in the page's HTML:
johnz
  • 489
  • 2
  • 17
0
votes
1 answer

web2py function call does not display pandas dataframe converted to html content as expected

I am a web2py beginner. I was trying a simple variation of hello3.py in the web2py examples. hello3.py file is def hello3(): import pandas as pd import numpy as np xx = pd.DataFrame(np.zeros(4).reshape(2,2)) message=xx.to_html() …
0
votes
2 answers

web2py - How to programmatically register users?

I would like to register users programmatically, so I can test my application with multiple users. The way I thought of doing this was: if db( db.auth_user ).count() == 0: alphabet = 'abcdefghijklmnopqrstuvwxyz' for letter in alphabet: …
evan54
  • 3,585
  • 5
  • 34
  • 61
0
votes
1 answer

How can I call a function before redirecting to the next URL in web2py?

I've defined the form as follows: form = crud.update(db.table, table_id, next=URL('nextpage')) crud.settings.update_onaccept = myfunction() I need to call myfunction() again after the form is submitted, but before the nextpage is loaded. Is there…
0
votes
1 answer

Webpage resubmitting data onto table after refresh [confirm form resubmission]

Whenever I submit the form, it works. If I try to refresh the page it'll ask this: then if I click continue it'll resubmit the data again onto the table. So essentially I'm asking how can I stop it from resubmitting the data into the table once…
0
votes
1 answer

Web2py Drop down menu that filters

New to html/javascript/web2py, but I been reading a lot and saw many different ways into sorting and some ways to filtering. However, I haven't found something that is similar to mine. Right now, I'm creating a website that is similar to Craigslist…
Yuri
  • 11
  • 3
0
votes
2 answers

web2py autocomplete widget not working

need a hint on web2py built-in autocomplete widget. in controller: db.otc_products.counterparty.widget = SQLFORM.widgets.autocomplete(request, db.counterparty.Long_Name, limitby=(0,10), min_length=2) in…
0
votes
1 answer

Using web2py for a user frontend crud

I was asked to port a Access database to MySQL and provide a simple web frontend for the users. The DB consists of 8-10 tables and stores data about clients consulting (client, consultant,topic, hours, ...). I need to provide a webinterface for our…
jlplenio
  • 115
  • 1
  • 9
0
votes
1 answer

Upload image in web2py to database from default controller following image blog example

I'm following this example to try and implement a way of uploading images from the default page of my application in web2py into the database. I went through the whole thing and can now view the images on the default page that were uploaded through…
Raul M
  • 124
  • 6
0
votes
1 answer

web2py pass parameters to controler and download a file

I have the following problem On my page user can select date from and date to. This dates are to be send to controller on button click, which creates an excel file and user receives that file? Any suggestions ?? Thank you
Yebach
  • 1,661
  • 8
  • 31
  • 58
0
votes
1 answer

Why does this Web2Py ajax call fail to return the value of a variable?

Here is the relevant snippet from my Web2Py view: {{for candidate in rows:}}
0
votes
0 answers

Why am I getting SSLError: when using requests in python

I was using requests without any issues until now but today I am getting this error and don't know why. I guess it have something to do with a certificate I created for web2py using this guide: http://www.web2py.com/AlterEgo/default/show/140 Could…
Lben
  • 83
  • 1
  • 12