I'm attempting to use web.py with Tokyo Cabinet / pytc and need to pass the db handle (the connection to tokyo cabinet) to my handler classes so they can talk to tokyo cabinet.
Is there a way to pass the handler to the handler class's init function? Or should I be putting the handle in globals() ? What is globals() and how do you use i...
I've created a web.py application, and now that it is ready to be deployed, I want to run in not on web.py's built-in webserver. I want to be able to run it on different webservers, Apache or IIS, without having to change my application code. This is where WSGI is supposed to come in, if I understand it correctly.
However, I don't unders...
I have this class:
class View(object):
def main_page(self, extra_placeholders = None):
file = '/media/Shared/sites/www/subdomains/pypular/static/layout.tmpl'
placeholders = { 'site_name' : 'pypular' }
# If we passed placeholders vars, append them
if extra_placeholders != None:
for k, v in extra_placehol...
If you had switched from php + (framework of choice) to python + (framework of choice) as your development platform, what would you say have been the upsides/gains of the switch?
What I want to know is if there were any significant improvements in the following aspects:
Speed of development
Maintainability of the finished solutions
...
For some reason I'm getting a Trace/BPT trap error when calling urllib.urlopen. I've tried both urllib and urllib2 with identical results. Here is the code which throws the error:
def get_url(url):
from urllib2 import urlopen
if not url or not url.startswith('http://'): return None
return urlopen(url).read() # FIXME!
I sho...
I use the built in 'sum' function in a web.py templator template and I get the following error:
global name 'sum' is not defined
Source code is below:
$if profs:
$for prof in profs:
$sum([1, 2, 3])
I can use 'sum' just fine at a Python REPL in the terminal.
What could be the issue?
Thanks,
Jacob
...
Hi,
I just built a small app with the very cool and minimalistic web.py.
I am using a cheap shared hosting package (at WebFaction) and have installed web.py via virtualenv. I cannot use the system python since I need additional packages which I'm not allowed to install into the system python.
So now I start my app with
/home/me/my...
A killer app is an app that make a library or framework famous. I think web.py is quite famous, but I don't know any big, widely used app written in web.py.
Could you point out any? I've head that the first version of youtube.com was coded using web.py but I'd like you to mention an open source one so I can see its code.
...
i am getting this error when doing database calls in a sub process using multiprocessing library.
http://pastie.org/811424
InternalError: current transaction is aborted, commands ignored until end of transaction block
this is to a postgres database, using psycopg2 driver in web.py.
how ever if i use threading.Thread instead of multip...
I am running the latest version of web.py with mod_wsgi and have this in my code:
application = web.application(urls, globals(), autoreload=True).wsgifunc()
It is autoreloading most of the time but every so often I need to go to the command line and restart Apache myself. Any idea why it is not always "autoreloading"?
Details:
Apach...
I am passing variable to template in web.py and have the same condition in some places. Like this:
$if myvar=="string1":
$passed argument1
............
$if myvar =="striung2":
$passed argument2
If say myvar is "string1" and I pass passed = "AAA" then I have AAA argument1 on my page, but the other if statements get replaced by e...
I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go:
Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, updated, or deleted (s...
This is a general question, or perhaps a request for pointers to other open source projects to look at:
I'm wondering how people merge an anonymous user's session data into the authenticated user data when a user logs in. For example, someone is browsing around your websites saving various items as favourites. He's not logged in, so the...
I want to selectively hide some resources based on some form of authentication in web.py, but their existence is revealed by 405 responses to any HTTP method that I haven't implemented.
Here's an example:
import web
urls = (
'/secret', 'secret',
)
app = web.application(urls, globals())
class secret():
def GET(self):
...
I'm adapting an application that makes heavy use of generators to produce its results to provide a web.py web interface.
So far, I could wrap the call to the for-loop and the output-producing statements in a function and call that using cProfile.run() or runctx(). Conceptually:
def output():
for value in generator():
print(...
So every web.py tutorial I've seen includes this line:
urls = (
'/', 'index',
)
And then, later on, the index class is defined with a GET function and so on. My problem is, this doesn't work. Using the code above, I get a 404 error. Using the following mapping works:
urls = (
'/.*', 'index',
)
But that's going to catch, at ...
I'm trying to get a web.py application running on GAE. I hoped that sth like the following might work
import web
from google.appengine.ext.webapp.util import run_wsgi_app
[...]
def main():
app = web.application(urls, globals())
run_wsgi_app(app)
But obviously the app object doesn't conform with the run_wsgi_app function's ex...
Using webpy, what's the proper way to reference the templates directory for web.template.render() so that it works on both the webpy development web server and on Apache?
The following code works using the development server but not when running on my Apache server.
import web
urls = (
'/', 'index',
)
class index:
def GET(self)...
I am making a simple web-app which requires login for the admin page. I came across this incantation on the web.py site (http://webpy.org/cookbook/userauth) :
import hashlib
import web
def POST(self):
i = web.input()
authdb = sqlite3.connect('users.db')
pwdhash = hashlib.md5(i.password).hexdigest()
check = authdb.e...
I get the uwsgi and nginx work,but myapp can not run,could you give me a help?thx all
ps:get infopage like:
uWSGI status (/)
masterpid: 0
started on: Wed Oct 13 22:12:02 2010
buffer size: 4096
total_requests: 33
workers: 1
...