web2py

accessing the web2py admin interface via wsgi

对着背影说爱祢 提交于 2019-12-25 02:18:41
问题 The web2py book states The administrative interface, admin, is only accessible from localhost unless you run web2py behind Apache with mod_proxy. If admin detects a proxy, the session cookie is set to secure and admin login does not work unless the communication between the client and the proxy goes over HTTPS; this is a security measure. All communications between the client and admin must always be local or encrypted; otherwise an attacker would be able to perform a man-in-the middle attack

One single MySQL database for many web2py applications

爷,独闯天下 提交于 2019-12-25 00:16:58
问题 I have 3 apps under my web2py framework. Can I use one single MySQL database for all of them (by prefixing tables) so users just need only one single registration to access those 3 apps? I fail on my attempts. Or any other solutions? Thanks so much. 回答1: If multiple apps share the same database table, all but one of the apps must define that table with migrate=False to prevent migration attempts. Note, Auth.define_tables() also takes a migrate argument, so to turn off migrations specifically

web2py : downloading zip file created by cStringIO text strings in controller

心已入冬 提交于 2019-12-24 19:43:23
问题 I have a web2py based portal where a group of annotators provide text labels and bounding-boxes related information for the various images shown to them. I'd like to get this information in the form of XML files (one-per-image) and add a download-annotations functionality to the portal which serves a ZIP file containing all these XML files. I am able to create a zip-download from the portal but unzipping the same throws the following error : mohit@nightfury13:~/Downloads$ unzip Arabic\ Set1

Getting 403 Forbidden Error Using web2py with Apache2 WSGI on Fedora

南笙酒味 提交于 2019-12-24 19:38:03
问题 I'm getting 403 Forbidden with the webpage displaying: Forbidden You don't have permission to access / on this server. The access log shows the following corresponding to this: [Mon Jan 20 17:12:03.888576 2014] [authz_core:error] [pid 1940] [client XX.XX.XX.XX:32491] AH01630: client denied by server configuration: /opt/web-apps/web2py/wsgihandler.py I've the following permissions set for the above directory: /]# ls -ld opt drwxrwxrwx. 4 root root 4096 Jan 10 20:05 opt opt]# ls -ld web-apps

web2py, Database relationships and permissions

被刻印的时光 ゝ 提交于 2019-12-24 10:02:55
问题 So i've this problem i've 2 tables for example templates(id,user_id,template_name,reference) user_settings(id,user_id,default_template) so each user can create many templates and in his settings he can choose a default template that he will always use so now there is many users so when a user want to choose a default template, he can see all templates (his own templates and the templates for the other users) tables are so defined: db.define_table('i2l_templates', Field('id','id', represent

pythonanywhere - How do I use websockets to transmit messages as per the web2py messaging example?

拜拜、爱过 提交于 2019-12-24 04:58:29
问题 So I've built out an app to test websockets with web2py and pythonanywhere and I got it to work locally but when uploading to pythonanywhere it doesn't work. I think the reason is that I'm sending things to localhost (127.0.0.1) but have no idea where I need to send things (and listen to) when uploading. the debug.py script is: def listen(): script=SCRIPT(''' jQuery(document).ready(function(){ var callback=function(e){$("#test_div").html(e.data)}; if(!web2py_websocket('ws://127.0.0.1:8880

web2py db is not defined

寵の児 提交于 2019-12-24 01:14:50
问题 I'm trying to run a script at command line that uses the models with the following command: c:\web2py>python web2py.py -M -N -S automate -R applications/automate/modules/eventserver.py but I keep getting the error: web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.99.7 (2012-03-04 22:12:08) stable Database drivers available: SQLite3, pymysql, pg8000, IMAP Traceback (most recent call last): File "c:\web2py\gluon\shell.py", line 206, in run execfile(startfile,

Storing Configuration details

本小妞迷上赌 提交于 2019-12-23 17:30:59
问题 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 as individual variables, stored in the model db.py settings_title = "My Amazing App" settings_ver = 2.0 settings_desc = "Moar and Moar cats" 2) Have them as a dict, stored in db.py settings = { "title": "My Amazing App", "ver" = 2.0, "desc" =

Limiting access to a static file with GAE

一个人想着一个人 提交于 2019-12-23 16:18:49
问题 I have a static file that I don't want to be publicly available. Is there a way to limit access with app.yaml so that it can only be loaded by its own domain? web2py based solutions are also welcomed as I'm using it on top of GAE. Thanks! 回答1: You can limit access to it with 'login: required' to require login with a Google account, or 'login: admin' to restrict it to admins only. If you're only concerned about abuse, you probably want to look into the DOS API instead. 回答2: I assume you want

“download link ” fails in IE

╄→尐↘猪︶ㄣ 提交于 2019-12-23 09:56:58
问题 I was trying to implement a "download link" and put it beside one of my report table so that users can download a csv file and open it with applications like Excel. The records are generated dynamically based on the query made by users. So somewhere in my controller there's something like: response.headers['Content-Type'] = 'text/csv' response.headers['Content-Disposition'] = 'attachment; filename=xxx.csv' return response.stream(dynamically_generated_csv, request=request) This works in both