web.py

Uploading & Encoding .xls File Python Web.py

ⅰ亾dé卋堺 提交于 2019-12-13 04:38:58
问题 I'm trying to create a web application that lets users upload an .xls file that I then take and feed that uploaded.xls file into my program which reads and parses it. I am currently using Python 2.7 on the Web.py framework. However, I am having issues with the utf-8 encoding for the Excel files. This method seems to be only working for .txt & .csv files, but when I try images or .pdf they don't work, so I'm not sure if the web.py built in library just doesn't support Excel files. When I

How to use radio buttons in python web.py

∥☆過路亽.° 提交于 2019-12-13 02:41:54
问题 I am using web.py framework to create a simple web application I want to create a radio button so I wrote the following code from web import form from web.contrib.auth import DBAuth import MySQLdb as mdb render = web.template.render('templates/') urls = ( '/project_details', 'Project_Details', ) class Project_Details: project_details = form.Form( form.Radio('Home Page'), form.Radio('Content'), form.Radio('Contact Us'), form.Radio('Sitemap'), ) def GET(self): project_details = self.project

Global variable usage with web.py in Apache

99封情书 提交于 2019-12-13 01:44:52
问题 I have come across a strange problem when I configured my web.py code with Apache. I have 3 variable which I need to use across 2 classes. I used to handle this using global variables but unfortunately that doesn't work now. Example: urls = ( '/', 'index', '/result','Result' ) # index is basically a form which takes some inputs class index: def POST(self): global VAR1, VAR2, VAR3 i = web.input() VAR1 = i.word1.__str__() VAR2 = i.word2.__str__() VAR3 = i.word3.__str__() raise web.seeother('

Django style multiple apps with web.py not working

半世苍凉 提交于 2019-12-13 00:37:42
问题 I run the example in the tutorial Django style multiple apps with web.py, but it does not working. The following is error message: Traceback (most recent call last): File "run.py", line 11, in <module> delegate.run(mapping) File "/home/siongui/dev/test/delegate.py", line 31, in run web.run(handler, {}) AttributeError: 'module' object has no attribute 'run' My web.py version is 0.37. Is there any idea on how to fix this? Thanks. (subapp is not a option for me.) 回答1: There is some addition for

How to run PHP and Web.py together

谁都会走 提交于 2019-12-13 00:34:32
问题 I normally web develop in PHP. I am working on a python based project, and want to make a front-end web site for it. I looked at web.py, and I was wondering if PHP can be used together with web.py, or would I have to rely completely on python as the server side scripting? Thanks. 回答1: Combining web.py and PHP doesn't really make sense. But you can definitely set up Apache to have both. You just install mod_php and mod_wsgi. Point mod_wsgi to your web.py WSGI function, and set up your PHP web

Inheritance in web.py?

我只是一个虾纸丫 提交于 2019-12-12 05:01:53
问题 I am currently developing wep.py application. This is my web application which is binded with web.py and wsgi. root/main.py import web import sys import imp import os sys.path.append(os.path.dirname(__file__)) #from module import module from exam import exam urls = ( '/exam', 'exam' ) application = web.application(urls, globals(), autoreload = True).wsgifunc() My application has an abstract class called module in module.py in root directory and its purpose is to be inherited by modules. root

Correct way to return JSON response from POST request with web.py

最后都变了- 提交于 2019-12-12 04:06:14
问题 I have a web.py server. I handle post requests like this: class Endpoint(object): def POST(self): received_payload = web.data() # Do things with the payload (a JSON) --- I receive the payload correctly response = {"Response": "Good"} # I also tried returning the dictionary directly and building my own requests.Response object return json.dumps(response) I am able to correctly receive and process the payload I send to the server, but I do not receive the response. On the client side, I do this

WebPy Sessions with Templates

喜夏-厌秋 提交于 2019-12-12 03:47:25
问题 Using Webpy. I have the following code in my app.py: app = web.application(urls, globals()) session = web.session.Session(app, web.session.DiskStore('sessions'), initializer={'count': 0, 'username': 'CRC'}) render = web.template.render('templates/', base="base", globals={'context': session, 'username': 'CRC'}) class Index(object): def GET(self): if not session: session.count = 0 else: session.count = 1 return render.hello_form() def POST(self): form = web.input(name="Nobody", greet="Hello")

webPy Sessions - Concurrent users use same session and session timeout

喜你入骨 提交于 2019-12-11 20:06:22
问题 I have a webPy app using sessions for user authentication. Sessions are initiated like so: web.config.debug=False store = web.session.DiskStore('/path_to_app/sessions') if web.config.get('_session') is None: web.config.session_parameters['ignore_expiry'] = False web.config.session_parameters['timeout'] = 600 web.config.session_parameters['max_age'] = 600 web.config.session_parameters['ignore_change_ip'] = False web.config.session_parameters['expired_message'] = 'Session Expired... Please

web.py User Authentication with PostgreSQL database example

扶醉桌前 提交于 2019-12-11 15:39:14
问题 I am trying to copy and use the example 'User Authentication with PostgreSQL database' from the web.py cookbook. I can not figure out why I am getting the following errors. at /login 'ThreadedDict' object has no attribute 'login' at /login 'ThreadedDict' object has no attribute 'privilege' Here is the error output to the terminal for the second error. (the first is almost identical) Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web