I did some testing on my app, which still implements the welcome app's
default/index function that shows Hello World. Here are my results:
BEFORE TRUNK UPDATE - CONCURRENCY 1
===
Time taken for tests: 108 seconds
Requests per second: 9.25
Time per request: 108.138
I just noticed that the sessions are still being saved, which may be why I
didn't see any performance improvement. I deleted all of the sessions inside
the sessions folder, stopped and restarted the server, then visited the
/default/index page that flashes 'You are successfully running web2py.'
Since most orders contain line items, you might consider making an
order_header table that stores information about the order, then a
order_detail table that stores the information about each line item.
No form, I have customized the layout.html file, but nothing that uses
session or forms.
Here is the controller:
def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
response.flash =
Ok, that makes sense. My app connects to a MSSQL database on another
machine, so that explains the response times > 100 ms for me. So would
setting pool_size to 1 on the DAL keep at least one database connection open
for future page views and speed things up?
I have been trying this for a while now and have had some serious problems
with BLOBs. I have taken the DAL out of the equation by using executesql().
I am grabbing a picture blob from an existing database (each picture os
about 35 kb). I am taking the blob and writing it to a file, but only the
I figured it out finally. since I'm using MSSQL and FreeTDS, I had to work
around a strange problem in FreeTDS that I'm guessing is a bug. Here is the
StackOverflow page where the answer
is:
http://stackoverflow.com/questions/1060035/using-pyodbc-on-ubuntu-to-insert-a-image-field-on-sql-server#
I have been running Chrome dev channel (11.0.696.3) for a while and never
had this problem. Chrome does sometimes have a problem pulling data from its
own cache. Try emptying the cache on it, close, and reopen to see if that
solves it. Otherwise, you might have to manually delete Chrome's cache
I'm running a bunch of tests now. I'll report back in a few with my results.
Ok, here are the results from testing the welcome app:
BEFORE TRUNK UPDATE
=
Time taken for tests: 91.843 seconds
Requests per second: 10.89
Time per request: 91.843 ms
BEFORE TRUNK UPDATE WITH MIGRATE=FALSE AND BYTECODE COMPILED
==
Jonathan has done some awesome work with routing, and I hit my first
problem. I have a table called auth_user_extended, which I use to store
extended information not included in the default auth_user table. One of the
fields in this table is an upload field called picture. The actual file in
th
In that case, great job to you both!
On Mar 16, 2011, at 1:57 PM, Massimo Di Pierro wrote:
> You should also thank Jonathan, we have been working together on this.
>
> Massimo
>
> On Mar 16, 11:40 am, Ross Peoples wrote:
>> Ok, here are the results from testing the welco
Yep, you're right. I did it wrong. I should have known to use args=. Thanks.
On Mar 16, 2011, at 2:06 PM, Jonathan Lundell wrote:
> On Mar 16, 2011, at 10:48 AM, Ross Peoples wrote:
>> Jonathan has done some awesome work with routing, and I hit my first
>> problem. I
>From my understanding, sessions are only forgotten if not changed, so
if you add something to the session, it gets saved. This speedup
prevents saving the session when there is nothing to save.
And you could always use cache or db for analytics if that's what you
are looking for.
Ross
That would be pretty cool. You sometimes have to jump through a few hoops to
see all the variables and SQL code.
To answer simply, yes the embedded Rocket server will handle
multiple simultaneous requests. However, if you have long-running processes,
they may force Rocket to wait until they are finished before responding to
additional requests. This is easy to overcome by using Python's multiprocess
modul
You've got to admit that it's kind of funny that someone always asks
about the recording script every time you post one of these videos.
You must be doing something right :)
On Mar 21, 2:19 pm, Massimo Di Pierro
wrote:
> http://blip.tv/file/4912976
I had a similar question as you a few weeks ago. I can tell you that
the reason why admin doesn't allow you to select a default application
is because admin would have to edit routes.py, which could break
everything if not done right and it also requires a server restart, so
that's why no one has a
I tried this once and it failed terribly. I would also like to know
how this would work.
On Mar 22, 6:12 pm, Keith Pettit wrote:
> Web2py works great for me through Apache and mod_wsgi. All seems fast and
> clean. But now that I'm creating multiple web2py applications. How can I
> deploy multi
t's kind of
> confusing with the two examples that don't quite work so I thought I'd
> mention it.
>
> Thanks for the help,
>
> -Keith
>
> On Tue, Mar 22, 2011 at 1:14 PM, Ross Peoples wrote:
> I had a similar question as you a few weeks ago. I
Unless there is some unknown trick, I was unable to find a way to make this
work, which is why I turned my script into a subclass of Process. Though I
do know Rocket can handle multiple simultaneous downloads at once since it
allows the browser to download multiple files from /static at the same
Another option for non-SQLite databases is to use truncate() on each table.
But you have to truncate() in the right order for tables that reference each
other, otherwise the truncate operation will fail.
Bruno,
I too have had this problem. It seems as if Mac OS X has some real problems
connecting to MSSQL, which isn't too much of a surprise I guess. The way
that I develop on Mac OS X may be crazy or over-complicated, but I find it
works well for me:
I set up a Ubuntu Server virtual machine in
Glad you were able to figure it out.
web2py will automatically convert dashes to underscores for the function
names, so:
getting-started
will become:
def getting_started():
return dict()
You should be able to go to
http://127.0.0.1:8000/[appname]/[controller]/getting-started and have the
page show up. Replace [appname] with the name of your application, and
[controller] with the name of the controller. So if your application is
named 'myapp' and you are using the 'default' cont
Plumo said it best. Hosting really makes a difference. You may want to try
testing a very simple page to see how long it takes to load:
def test():
return dict()
If that controller takes a few seconds to come up, then you know something
is wrong with your hosting. If you are having problems
I just added myself as well.
Wow, I got approved for this about 4 hours ago and I just received an email
from someone a few minutes ago in my area asking for help to develop a
project in web2py.
Massimo, is a job board or similar a possibility with this site? I only ask
because it looks like people are already using it to
The extra shared memory allows PostgreSQL to cache more and perform better.
It's mostly for production servers. It shouldn't have any adverse effects on
the Mac. If it's the same setting I'm thinking of, then all it does is
increase the amount of shared ram a single application can use. If it do
Showing us the model would help too, especially if you are connecting to a
legacy database.
I certainly did. We need a good IDE for web2py.
I do have to say that the first time I went looking for help, I went to the
IRC channel, that had 7 people in it, all of which were idle. The IRC
channel would be great for answering quick questions for new users, and
joining a mailing list does require a bit of commitment. For the more in
dept
Massimo's idea would work, but the table would need to have "membership_id"
set up as an identity field. If your existing structure requires you to
manually fill in this value yourself, then you would have to do your inserts
manually using executesql:
db.executesql("INSERT INTO member (membersh
Could you be a little more specific? Are you trying to pass args and vars?
Or are you trying to load HTML using AJAX and sending it to a target DIV? If
you are using web2py's ajax function, you may be limited to what you can do.
Worst case, you can always try calling jQuery's load() method:
var
That's basically how it works. Although as you learn more about AJAX, you'll
find that there are a bunch of different ways to do this, including more
2-way types of communication, where you would do something with the data
returned from the controller before or after displaying it on the page. O
You should really be joining the queries:
records = db(db.person.id==db.cats.owner).select(db.cats.ALL, db.person.ALL)
Then in your view, you access this by using:
{{for record in records:}}
{{=record.person.name}}: {{=record.cats.name}}
{{pass}}
Using the @auth.requires_login() on every function is the only way I know
of. However, you may be able to put something like this at the top of each
controller:
if auth.user is None:
redirect(URL('default', 'login'))
However, it might cause a problem if you put that in your default
control
I'm not sure if there is a way to fix this. Maybe am experienced Flash guy
can help, but since YouTube is using the Flash Player plugin, you may not be
able to control its z-index. Even if you do, I don't think there is a
cross-platform, cross-browser solution.
I use the trunk on Mac. I actually downloaded MacHG, which is a GUI for
Mercurial, then did a pull from the web2py repository on to a folder on my
Mac. The way you get web2py from trunk is pretty much the same across all
platforms. If you want to update your executable to the trunk version, you
I was able to get background processes to work pretty well. I have an import
script that takes a minute or two to run and is started by an ajax call from
a button in one of my views, and the progress is reported back to the page
as the script runs. The way I did this was to use multiprocessing.
If you are trying to pass arguments and variables to a controller, then you
should use URL like this:
URL('controller', 'function', args=['arg1', 'arg2'], vars={'var1': 'value1',
'var2': 'value2'})
Notice that args takes a list [ ], and vars takes a dictionary { }, even if
you only have one ar
But if you are trying to pass arguments to an action in a controller like
this:
def test(arg1, arg2):
#some code here
This will not work, as actions must not take any arguments in the
definition. If this is really what you're going for, then you could do
something like this:
def test():
I've never used GAE, but I know a lot of people here use it. I never knew
that GAE couldn't do joins. Seems like a pretty big restriction on Google's
part.
You're right, my bad :)
If you want to do that, then you would make _test(arg1, arg2) its own
function in the controller. So instead of:
def test():
def _test(arg1, arg2):
You would just do:
def test():
# call _test(arg1, arg2)
def _test(arg1, arg2):
# code here
Putting _test inside of test() just makes
It should work. And if it's a never-ending process, then instead of calling
it in the controller, you'd have to call it right after local_import in your
db.py. You would also need to turn the ImportScript into a singleton and
make sure it only gets initialized once because you don't want to spin
I've been developing my application for 6 weeks now and I stay updated with
the trunk version of web2py. I know that Massimo, Johnathan, and others have
been working to increase performance of web2py, but I had to make a Django
app for someone that was similar to one of the web2py applications I
I think the sessions are locked while a controller is running using the same
session. So it would slow down concurrent requests via AJAX and things like
that, but that's why you need to call session.forget(request). Massimo's
tips will certainly help, but I didn't know if there were any known
b
I turn everything into modules, so I use local_import() ALOT. If I have a
local import that looks like this:
DEBUG = True
my_module = local_import('my_module', reload=DEBUG)
How would I write that with the new importer?
Reloading would be awesome, but making it optional would be the best choice,
as sometimes you want your modules to persist across requests for
performance reasons (so that modules don't get reloaded for every request in
a production environment).
Just tossing my two cents in here, but documentation (especially that of
experimental features) is really important and can make a huge difference.
Django actually had http://www.djangobook.com/en/2.0/ which was pretty cool,
but they haven't maintained it. It gives you two versions, a stable boo
This is a copy & paste of something I wrote a month ago or so:
I was able to get background processes to work pretty well. I have an import
script that takes a minute or two to run and is started by an ajax call from
a button in one of my views, and the progress is reported back to the page
as
I was wondering if anyone has ever tried anything like this before: I
have an application that will be running mostly from data via Python
API calls. This means that I won't really need to use the database at
all. The problem with this approach, is that some important web2py
features are only avail
I just got around to responding...I was going to suggest PySerial, as I use
that to communicate with an attached piece of hardware. Seems to work well
cross-platform.
After thinking about this a little more, maybe a custom DAL adapter or
something would probably be the only way to handle this, which is no easy
task. Does anyone else have any ideas?
')
> db.fetch_tables()
>
> mind this would be not too difficult to implement.
>
>
>
>
> On Apr 28, 10:25 am, Ross Peoples wrote:
> > After thinking about this a little more, maybe a custom DAL adapter or
> > something would probably be the only way to handle this, which is no easy
>
> > task. Does anyone else have any ideas?
I started thinking about an in-memory sqlite database, which might be an
option. It would be a lot of work, but I think it might be my best option so
far. How's the performance of in-memory sqlite databases (inserts and
selects)?
This is pretty awesome and will be very helpful with large,
enterprise applications, as well as applications that do many things that
are not all related. I wonder if we could take this a bit further though...
Plugins, for example, extract themselves to the various locations (models,
controller
Experts4solutions has hooked me up with someone nearby looking to do a long
term job which plans to sell a web2py app as an appliance. Instead of
getting paid up front or by the hour, I chose to take a percentage of
profits, since it's just me and the other person working on it. I can only
devo
I work a lot with modules, so I have a question. I have a
'z_import_modules.py' model that would look something like this:
DEBUG = True
module1 = local_import('module1', reload=DEBUG)
module2 = local_import('module2', reload=DEBUG)
module3 = local_import('module3', reload=DEBUG)
obj1 = module1.O
I made a typo in my second 'z_import_modules.py' model:
obj1 = Object1()
obj1 = Object1()
Should be:
obj1 = Object1()
obj2 = Object2()
obj3 = Object3()
Sorry about that.
Thanks for clearing that up. I'll start rewriting my modules and let you
know how it all turns out.
I had similar issues with computed fields. I don't know if this helps or
not, but it looks like you are using member_status as a selection of hard
coded options. This is what I do:
db.member_statuses = {
1: 'Active',
2: 'Inactive',
}
db.define_table('auth_user_extended',
Field('auth_user',
I am still in the process of rewriting my modules and I've run into a
problem. First, I noticed that auth is not part of current. Only cache,
session, request, response, and T are a part of current. I have
z_import_modules.py model that I used to use to import modules using
local_import(). Howe
Ignore the part about 'from gluon import current' not working in the models.
Restarting the web2py server fixed the problem. I may have forgotten to do
that after updating from trunk.
But out of curiosity, is there a reason other model variables (auth, db,
etc) are showing up in current?
That would be nice. Also might I suggest a way to import
gluon.storage.Storage when doing 'from gluon import *'. I find myself using
Storage a lot, so having that load as a part of 'from gluon import *' would
be awesome.
I think you have an {{include 'file'}} somewhere in one of your templates,
and it can't find the filename.
Updated web2py from trunk this morning. Something changed in tools.py in the
last few days that caused the following code to fail:
attachment = (Mail.Attachment(filename))
The error that results:
File "/media/psf/Python/web2py/gluon/tools.py", line 139, in __init__
content_type = contenttyp
Thanks Massimo!
Glad to see this made it into the trunk!
Just wanted to give an update:
I moved one of my projects with about 10 modules over to the new import
method, and so far it's working perfectly. I should also mention that the
new method has greatly simplified the way I write modules. I used to have a
z_import_modules.py model that should run
You should also make sure your pg_hba.conf is set up to accept remote
connections and that your user account can log in from remote connections. I
once had a development PostgreSQL server that had its config reverted to
factory settings one day for no apparent reason. I banged my head against
t
I don't know if there would be a good way to do this with any DAL/ORM. The
best and most reliable way to handle this (and I hate to say it) might be
using triggers in your database server. So that any change would trigger an
audit action by the SQL server, which would write the change to an audi
I think I saw it mentioned here before, but are there any plans to break up
plugin_wiki into smaller plugins? There are some individual plugins inside
plugin_wiki that are really nice on their own, and it's kind of shame that
you'd have to use the entire package just to use one or two of the plu
The only thing that had really worked for me in the past was doing the if 0:
trick:
if 0:
from gluon.dal import DAL
from gluon.tools import Auth
db = DAL()
auth = Auth()
The code won't actually get executed, it's just there to give Eclipse and
other IDE's some direction.
If thi
I know this question has been asked before and I have been doing research on
the matter for a while now. I am writing an application that has some
proprietary stuff in it, and the plan is to sell the compiled w2p file. I
know that the pyc files can be decompiled. A quick trip
to http://www.depy
What matters is that the code is not easily decompiled, and if it is, then
almost impossible to read or figure out what the code is doing. The idea is
to protect some or all of the code from being stolen, basically. I just used
depython.net as an example of how easy it is to get an almost perfec
In the spirit of not messing around with "half baked, unstable,
hard to maintain, constantly breaking backward compatibility, glued
frameworks":
web2py - For serious developers
web2py - Stop playing, start producing
web2py - Upgrade your development
web2py - Development for the professionals
Th
>From the responses I've gotten here, and research elsewhere, I think there
are only two real options:
1. Obfuscate and compile
2. Use Cython to turn Python code files into C modules.
Other option could be to somehow use cx_Freeze or similar tool to wrap the
entire web2py installation. However,
I can't say I've ever really tried this, but maybe you could do something
like this in your model:
db.pineapple_insert(**kwargs):
if db(db.pineapple.id > 0).count() >= 3:
raise Exception('There are already 3 pineapples in this table.')
else:
db.pineapple.insert(**kwargs)
I've really gotta start proofreading my responses. This is a better version
that the one I just gave (goes at the bottom of the model):
def pineapple_insert(**kwargs):
if db(db.pineapple.owner == auth.user.id).count() >= 3:
raise Exception('There are already 3 pineapples for this user
On Sunday, December 28, 2008 3:43:55 AM UTC-5, mdipierro wrote:
>
> in trunk now... IS_IN_DB(orderby=)
I realize that this thread is like 2.5 years old, but this should be in the
book. I was looking for this functionality and found it here.
Does web2py support Python 3?
$15,000?!?!? They are freaking insane. Most web sites prolly don't even pull
that in profit a yearall just to login to a site with a Facebook/Twitter
account? Web2py should prolly have its own auth method in that case.
I just updated web2py to the trunk version on a server running Python 2.4.4
and it immediately crashed with an error because of the try/except/finally
usage in the new custom_import.py file. This is easy to fix though. Instead
of using:
try:
# code
except:
# code
finally:
# code
You
I think I figured out how to make it work, but I don't know if it breaks
anything. In conjunction with the change above, I also did this:
Changed custom_import.py line 49 from:
return self.std_python_importer(name, globals, locals, fromlist, level)
To this:
if sys.version_info[:2] == (2, 4):
I am developing a web2py app that uses a third party python module that only
works on Python 2.4.4. Basically, we are using we2py as a front end for an API.
Since recently updating to trunk, I noticed that several things didn't seem to
work anymore. I submitted patches to Massimo and he told me
The problem is that our app is using an API as a frontend to a third party
application. The Python API available to talk to this product only works in
Python 2.4.4. I have been successfully using Web2py 1.95.1 on Python 2.4.4
without any issues. It was only after I updated to the trunk version t
I don't suppose there's a way to run this module under Python 2.4.4 and run
web2py under 2.5 is there? The API is bytecompiled and has to run 2.4.4 (and
actually the API installs it own custom Python 2.4.4 instance). Is there any
way to do this? This would solve the web2py dependence on Python 2
I spent about 45 minutes hashing this out over the phone and I think the
best solution (at least for our needs) is to make a lightweight JSON-RPC
server that talks directly with the third-party API running in Python 2.4.4.
Then we can run web2py on whatever Python version we want and just make
I had thought about that and just using the builtin Rocket server to host
the service. That might be the best way to go.
Just to give an update, I have successfully split this off into two web2py
instances: one running under Python 2.4.4 that only acts as a JSON-RPC
server, and a second web2py instance running on 2.6.1 that is using the
trunk version of web2py. After banging my head against a wall with regards
to
I haven't actually tried this yet, but couldn't you do something like this
to turn it off/on:
import gluon custom_import
custom_import.DEBUG = False
I was thinking about setting this in a db.py file or something to indicate
that the app in in debug mode. Then before deploying, setting this to false.
Also allowing controllers, modules, etc to access the value of this might be
beneficial. It could be a master 'debug' switch for an entire appli
On a quick side note, you are not supposed to use Webmin with Ubuntu. It is
mentioned in several places that it breaks Debian-based systems. Ubutnu has
been pushing eBox (now Zentyal) which is more for setting up a small
business infrastructure than managing a web server. As is mentioned,
manag
This is the original source:
https://help.ubuntu.com/community/WebMin
and here's a bug report about it:
https://answers.edge.launchpad.net/ubuntu/+question/2873
These two are a bit old now, so I don't know if things have changed, but
merely mentioning the word webmin in the Ubuntu forums a cou
Have you checked the base.css file for textarea references?
Did you subclass the Auth class or something? And more importantly, did you
restart your web2py server after updating from trunk?
I would also have to say that SSL is an industry standard, even by
government and payment card processing standards. I have to keep a Ubuntu
web server up to the latest PCI (payment card industry) tests since we
process credit cards internally. The test runs quarterly and emails me a
report of
301 - 400 of 573 matches
Mail list logo