[web2py] Re: One-Step Production Deployment: Who Moved the Cheese?
But what if my Ubuntu server is already setup for Apache. Do I have to abandon or *uninstall* Apache? I don't have any experience with nginx. *Do I have learn nginx*, or will the setup-web2py-nginx-uwsgi-ubuntu.sh script *do everything for me* (I presume that's what one-step deployment means)? Thanks. On Saturday, 18 June 2016 19:36:58 UTC-4, Anthony wrote: > > Oops. It is now recommended that you use nginx+uwsgi instead of > Apache+mod_wsgi, so, you could change the URL to: > > > https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh > > Anthony > > On Saturday, June 18, 2016 at 4:35:37 PM UTC-4, horridohobbyist wrote: >> >> Is the web2py book out of date or out of sync? For one-step production >> deployment, the setup-web2py-ubuntu.sh file is no longer at Googlecode. >> >> How can I setup web2py to work on a headless Ubuntu server quickly and >> easily? >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] One-Step Production Deployment: Who Moved the Cheese?
Is the web2py book out of date or out of sync? For one-step production deployment, the setup-web2py-ubuntu.sh file is no longer at Googlecode. How can I setup web2py to work on a headless Ubuntu server quickly and easily? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to control authorization to REST api
I figured out what was wrong. It all comes down to CORS – CORS and user authentication are quite braindead (http://stackoverflow.com/questions/21850454/how-to-make-xmlhttprequest-cross-domain-withcredentials-http-authorization-cor). I decided to bypass all this CORS shit and do my own user authorization. Works like a charm. On Saturday, 30 May 2015 19:18:20 UTC-4, horridohobbyist wrote: I tried this decorator, too: auth.settings.allow_basic_login = True @auth.requires_login() jQuery still chokes on user authorization. Moreover, it tries to redirect you to a login page, which in my case is not applicable. On Saturday, 30 May 2015 14:32:24 UTC-4, horridohobbyist wrote: I'm trying to implement a REST api. I've coded the following: @request.restful() def api(): response.view = 'generic.json' # curl -k --user tyr...@yahoo.ca:Lannister -G -d var1=something1 -d var2=something2 # https://miramar21.com/tut_server/default/api/verify/person/:usr/:pwd # https://miramar21.com/tut_server/default/api/add/person # https://miramar21.com/tut_server/default/api/update/person/:id def GET(*args,**vars): auth.basic() if not auth.user: return dict(unauthorized=True) try: if args[0] == 'verify': if len(args) 3: table_name = args[1] usr = args[2] pwd = args[3] alg = 'pbkdf2(1000,20,sha512)' hash = str(CRYPT(digest_alg=alg,salt=False)(pwd)[0]) row = db(db[table_name].email==usr).select().first() if row: status = True if row.password == hash else False return dict(verified=status,id=row.id) return locals() if args[0] == 'add': if len(args) 1: table_name = args[1] return db[table_name].validate_and_insert(**vars) return locals() if args[0] == 'update': if len(args) 2: table_name = args[1] record_id = args[2] return db(db[table_name]._id==record_id). validate_and_update(**vars) return locals() except: return dict(fatal=True) return locals() return locals() I have a feeling that I'm not doing user authorization for the REST api correctly, although the following cURL command works fine: curl -k --user tyr...@yahoo.ca:Lannister https:// miramar21.com/tut_server/default/api/verify/person/james.b...@outlook.com/Prometheus When I try to use jQuery ajax to perform the same operation, it chokes on the user authorization, whether I use JS headers or beforeSend. So I suspect I'm doing something wrong. (But why is cURL working???) I just want to control user authorization as simply and cleanly as possible. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to control authorization to REST api
I'm trying to implement a REST api. I've coded the following: @request.restful() def api(): response.view = 'generic.json' # curl -k --user tyr...@yahoo.ca:Lannister -G -d var1=something1 -d var2=something2 # https://miramar21.com/tut_server/default/api/verify/person/:usr/:pwd # https://miramar21.com/tut_server/default/api/add/person # https://miramar21.com/tut_server/default/api/update/person/:id def GET(*args,**vars): auth.basic() if not auth.user: return dict(unauthorized=True) try: if args[0] == 'verify': if len(args) 3: table_name = args[1] usr = args[2] pwd = args[3] alg = 'pbkdf2(1000,20,sha512)' hash = str(CRYPT(digest_alg=alg,salt=False)(pwd)[0]) row = db(db[table_name].email==usr).select().first() if row: status = True if row.password == hash else False return dict(verified=status,id=row.id) return locals() if args[0] == 'add': if len(args) 1: table_name = args[1] return db[table_name].validate_and_insert(**vars) return locals() if args[0] == 'update': if len(args) 2: table_name = args[1] record_id = args[2] return db(db[table_name]._id==record_id). validate_and_update(**vars) return locals() except: return dict(fatal=True) return locals() return locals() I have a feeling that I'm not doing user authorization for the REST api correctly, although the following cURL command works fine: curl -k --user tyr...@yahoo.ca:Lannister https: //miramar21.com/tut_server/default/api/verify/person/james.b...@outlook.com/Prometheus When I try to use jQuery ajax to perform the same operation, it chokes on the user authorization, whether I use JS headers or beforeSend. So I suspect I'm doing something wrong. (But why is cURL working???) I just want to control user authorization as simply and cleanly as possible. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to control authorization to REST api
I tried this decorator, too: auth.settings.allow_basic_login = True @auth.requires_login() jQuery still chokes on user authorization. Moreover, it tries to redirect you to a login page, which in my case is not applicable. On Saturday, 30 May 2015 14:32:24 UTC-4, horridohobbyist wrote: I'm trying to implement a REST api. I've coded the following: @request.restful() def api(): response.view = 'generic.json' # curl -k --user tyr...@yahoo.ca:Lannister -G -d var1=something1 -d var2=something2 # https://miramar21.com/tut_server/default/api/verify/person/:usr/:pwd # https://miramar21.com/tut_server/default/api/add/person # https://miramar21.com/tut_server/default/api/update/person/:id def GET(*args,**vars): auth.basic() if not auth.user: return dict(unauthorized=True) try: if args[0] == 'verify': if len(args) 3: table_name = args[1] usr = args[2] pwd = args[3] alg = 'pbkdf2(1000,20,sha512)' hash = str(CRYPT(digest_alg=alg,salt=False)(pwd)[0]) row = db(db[table_name].email==usr).select().first() if row: status = True if row.password == hash else False return dict(verified=status,id=row.id) return locals() if args[0] == 'add': if len(args) 1: table_name = args[1] return db[table_name].validate_and_insert(**vars) return locals() if args[0] == 'update': if len(args) 2: table_name = args[1] record_id = args[2] return db(db[table_name]._id==record_id). validate_and_update(**vars) return locals() except: return dict(fatal=True) return locals() return locals() I have a feeling that I'm not doing user authorization for the REST api correctly, although the following cURL command works fine: curl -k --user tyr...@yahoo.ca:Lannister https:// miramar21.com/tut_server/default/api/verify/person/james.b...@outlook.com/Prometheus When I try to use jQuery ajax to perform the same operation, it chokes on the user authorization, whether I use JS headers or beforeSend. So I suspect I'm doing something wrong. (But why is cURL working???) I just want to control user authorization as simply and cleanly as possible. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Database Update of Encrypted Fields
I have the following table definition: db.define_table('person', Field('email',requires=IS_NOT_IN_DB(db,'person.email')), Field('password',requires=[CRYPT(salt=False)]), Field('reg_key')) I have the following function definition for a REST service: @request.restful() def api(): response.view = 'generic.json' def PUT(table_name,record_id,**vars): return db(db[table_name]._id==record_id).update(**vars) return locals() I execute this command: curl -k -X PUT -d password=Ferrari https://67.213.70.251/tut_server/default/api/person/7 I expect 'Ferrari' to be encrypted in the database after update, but I find plaintext instead. This doesn't seem right to me. What have I done wrong? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: iframes not working
I don't know what that means. On Thursday, 19 March 2015 20:14:13 UTC-4, Leonel Câmara wrote: Do you have any errors in the console? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] iframes not working
No matter what I do, I cannot use iframes in my web2py apps. The *same iframe code* used in a static HTML file served from the same server as web2py works fine. (For testing, I used the same example as in the web2py book: iframe src=http://web2py.com;/iframe) Here's the odd thing: It has to do with the blocking of mixed content, which is the default in both Chrome and Firefox (but not Safari!). *This blocking of mixed content only affects my web2py apps.* Like I said, iframes in static HTML files work fine. This is incomprehensibly weird. Anybody know what the hell is going on??? Is there a way to force iframes to work on all browsers from web2py? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: iframes not working
Yes... Mixed Content: The page at 'https://67.213.70.251/welcome/default/index' was loaded over HTTPS, but requested an insecure resource 'http://web2py.com/'. This request has been blocked; the content must be served over HTTPS. On Thursday, 19 March 2015 20:57:34 UTC-4, Leonel Câmara wrote: If you open the page with the iframe in google chrome and you press F12 and then click on the console tab do you see errors? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: iframes not working
Okay, so I changed the http: to https: in the iframe's src. That *should* solve the problem... However, the console shows that the URL was changed back to http:. WTF. Who's doing this??? I brought up View Source just to make that the src was, in fact, https:. Yep, it is. So for some reason, *something* is changing it back to http:... Really, really weird. On Thursday, 19 March 2015 21:35:11 UTC-4, Leonel Câmara wrote: Yep, the error is pretty explicit. If you use https all resources you load in the page should be pulled using https too. Just change the src of the iframe to use it. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] SQLFORM refresh
If I use SQLFORM to update an existing record and some of the fields may be altered (eg, uppercased, or stripped of whitespace), I would like the form to show the resulting field values, not the ones that the user originally entered. I can see no way to do this. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] SQLFORM Validation and Password Hashes
The table definition is: db.define_table('teams', Field('team_email',requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'teams.team_email')]), Field('password',requires=[IS_STRONG(upper=2),CRYPT(salt=False)]), Field('team_name',requires=[IS_TEAM_NAME(),IS_NOT_IN_DB(db,'teams.team_name')]), Field('reg_date','datetime',readable=False,writable=False,default=datetime.datetime.today()), Field('reg_key',readable=False,writable=False), Field('team_size',requires=IS_IN_SET([1,2,3,4])), Field('team_captain',requires=IS_NOT_EMPTY()), Field('second_member',requires=IS_CONDENSED()), Field('third_member',requires=IS_CONDENSED()), Field('fourth_member',requires=IS_CONDENSED()), Field('school',requires=IS_NOT_EMPTY()), Field('teachers_email',requires=IS_EMAIL())) The call to SQLFORM in the default controller is: record = db.teams(id) form = SQLFORM(db.teams, record) if form.process().accepted: response.flash = 'profile updated' What other code would be helpful?? On Tuesday, 10 March 2015 02:13:26 UTC-4, Johann Spies wrote: On 10 March 2015 at 06:53, horridohobbyist horrido...@gmail.com javascript: wrote: I use SQLFORM to add records to a table. However, one of the fields is a password which requires=[IS_STRONG(upper=2),CRYPT(salt=False)]. I would like to use SQLFORM to update records in the table, but I run into a problem: the password field contains the hash of the password, which will not pass validation. So even if I don't change the password field, SQLFORM insists that I enter something that can be validated. If I can't use SQLFORM, then I will have to build my own form and do everything from scratch, essentially mimicking SQLFORM. That seems to me to be a lot of unnecessary work. Is there an easy workaround? (Yeah, I'm still a web2py newbie.) Showing your code will help people on this list to help you. Regards Johann -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] SQLFORM Validation and Password Hashes
Nobody has any ideas?? Surely, this is a common use case... On Tuesday, 10 March 2015 07:41:45 UTC-4, horridohobbyist wrote: The table definition is: db.define_table('teams', Field('team_email',requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'teams.team_email')]), Field('password',requires=[IS_STRONG(upper=2),CRYPT(salt=False)]), Field('team_name',requires=[IS_TEAM_NAME(),IS_NOT_IN_DB(db,'teams.team_name')]), Field('reg_date','datetime',readable=False,writable=False,default=datetime.datetime.today()), Field('reg_key',readable=False,writable=False), Field('team_size',requires=IS_IN_SET([1,2,3,4])), Field('team_captain',requires=IS_NOT_EMPTY()), Field('second_member',requires=IS_CONDENSED()), Field('third_member',requires=IS_CONDENSED()), Field('fourth_member',requires=IS_CONDENSED()), Field('school',requires=IS_NOT_EMPTY()), Field('teachers_email',requires=IS_EMAIL())) The call to SQLFORM in the default controller is: record = db.teams(id) form = SQLFORM(db.teams, record) if form.process().accepted: response.flash = 'profile updated' What other code would be helpful?? On Tuesday, 10 March 2015 02:13:26 UTC-4, Johann Spies wrote: On 10 March 2015 at 06:53, horridohobbyist horrido...@gmail.com wrote: I use SQLFORM to add records to a table. However, one of the fields is a password which requires=[IS_STRONG(upper=2),CRYPT(salt=False)]. I would like to use SQLFORM to update records in the table, but I run into a problem: the password field contains the hash of the password, which will not pass validation. So even if I don't change the password field, SQLFORM insists that I enter something that can be validated. If I can't use SQLFORM, then I will have to build my own form and do everything from scratch, essentially mimicking SQLFORM. That seems to me to be a lot of unnecessary work. Is there an easy workaround? (Yeah, I'm still a web2py newbie.) Showing your code will help people on this list to help you. Regards Johann -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] SQLFORM Validation and Password Hashes
I use SQLFORM to add records to a table. However, one of the fields is a password which requires=[IS_STRONG(upper=2),CRYPT(salt=False)]. I would like to use SQLFORM to update records in the table, but I run into a problem: the password field contains the hash of the password, which will not pass validation. So even if I don't change the password field, SQLFORM insists that I enter something that can be validated. If I can't use SQLFORM, then I will have to build my own form and do everything from scratch, essentially mimicking SQLFORM. That seems to me to be a lot of unnecessary work. Is there an easy workaround? (Yeah, I'm still a web2py newbie.) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] The Zen of web2py
I was thinking the other day it's so unfortunate that web2py has to live in the shadow of the great Django. As Massimo pointed out a while ago, the reason is because Django gets great PR. And Django users are a very vocal bunch. You can't walk the web framework landscape without tripping over articles and blogs about Django extolling its advantages and crowing about its success in the enterprise. By comparison, there are very few such articles about web2py. Yes, I know, Django's community is about 10x the size of ours, but that's really just an excuse. There's no reason why we can't be the 300 charging forth into battle against the Persians at Thermopylae. Surely, we are made of sterner stuff. I'm too humble to think of myself as Leonidas, but I did try to start the ball rolling with this article https://medium.com/@richardeng/the-zen-of-web2py-ede59769d084. Hopefully, some (or many?) of you will follow suit. Let's improve web2py's PR. A blast of articles over the next year could change the fortunes of our favourite web framework. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] The Zen of web2py
Excellent point. We don't need to criticize Django. We can compare Django and web2py side by side, and show how web2py makes the job so much easier. Which brings up another point... One of the most common refrains I hear about Django vs something like web2py is that when you scale to really BIG applications, Django has the advantage in terms of flexibility and power (by virtue of being more explicit). We need to quash this notion immediately. Developers are very anal when it comes to whether a tool can be used to build on a grand scale. We need to show that web2py has no limitations in this regard. A most appropriate article, then, would be one which points to several (high profile?) enterprise examples where web2py is used to build BIG applications. I'm sick of hearing how Django was used in Disqus and Instagram and Mozilla and NY Times and Pinterest. Cheers. On Wednesday, 9 July 2014 11:53:01 UTC-4, Michele Comitini wrote: I agree, web2py is a pragmatic framework. so the best way to make it shine is comparing how to get something done: there is not (only) theoretical blather behind it, facts and results drive web2py from the start. Usually is better avoiding critics towards others, but rather underline the qualities of web2py. That's a fundamental salesman skill. 2014-07-09 17:36 GMT+02:00 Carlos Costa yamand...@gmail.com javascript: : I agree with you Massimo, the best ones are those that built something. Videos like this http://vimeo.com/6782736 helped me to decide to stay with web2py. Not only that title is quite marketish but content is so true. 2014-07-09 12:28 GMT-03:00 Massimo Di Pierro massimo@gmail.com javascript:: I think this would help a lot web2py. I can share some personal experience. In my experience the best articles are those that show how to build something and focus on one feature at the time. People are very religious about certain frameworks and for the message to get across one really has to convince them that web2py will save them time and pain. One cannot convince everybody, but one can choose a target audience. I like comparison: this is how you do X in Django (for example) - this is how you do in web2py. The reason I like them is that they talk to a clear audience and users of both frameworks have something to learn from each other. Mind some people are very touchy and they do not like to be told that another kid has a shiner tool. Massimo On Wednesday, 9 July 2014 08:12:55 UTC-5, yamandu wrote: I like it. I wonder if we could do it in an organized in some way. Recently I lost to convince my boss to change everything to web2py because there are few developers that know it. So it would be very good to have a massive community. As we will have more opportunities to work on the framework we love best. Groups like this have little exposure outside. We need something else! 2014-07-09 10:03 GMT-03:00 Philip Kilner ph...@xfr.co.uk javascript: : Hi, On 09/07/14 13:31, horridohobbyist wrote: Let's improve web2py's PR. A blast of articles over the next year could change the fortunes of our favourite web framework. Good piece, great finish. I'll take that as a challenge, and see if I can describe my own journey from desktop databases to web2py via Zope and Plone as succinctly! :-) -- Regards, PhilK e: ph...@xfr.co.uk javascript: - m: 07775 796 747 'work as if you lived in the early days of a better nation' - alasdair gray -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Att. Carlos J. Costa Cientista da Computação Esp. Gestão em Telecom º)) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Att. Carlos J. Costa Cientista da Computação Esp. Gestão em Telecom º)) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe
[web2py] Re: Database compute fields
Are you saying I have to update the price field, regardless of whether it has changed or not?? That's not very logical. On Sunday, 13 April 2014 18:39:51 UTC-4, Anthony wrote: I believe you have to provide the price field in your update as well. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Database compute fields
Sonovagun, you're right! But that rather diminishes the usefulness of 'compute', IMO. On Monday, 14 April 2014 08:15:14 UTC-4, Anthony wrote: Yes, otherwise the DAL would have to do a db query to retrieve all the records being updated and issue a separate update for each record (since they may not all have the same price value and therefore might require different updated values in the computed field). On Monday, April 14, 2014 7:09:07 AM UTC-4, horridohobbyist wrote: Are you saying I have to update the price field, regardless of whether it has changed or not?? That's not very logical. On Sunday, 13 April 2014 18:39:51 UTC-4, Anthony wrote: I believe you have to provide the price field in your update as well. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Database compute fields
I have the following table: db.define_table('cart', Field('quantity','integer'), Field('in_stock','integer',writable=False,represent=lambda v, r: 'Pre-ordered' if v 0 else '√'), Field('price','float',writable=False,represent=lambda v, r: 'C'+locale.currency(v,grouping=True)), Field('subtotal','float',represent=lambda v, r: 'C'+locale.currency(v,grouping=True), compute=lambda r: r.price*r.quantity)) I find that when I update the 'quantity' field, the 'subtotal' field does NOT get recomputed. Is this a bug, or expected behaviour? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] SOAP
I would like to use SOAP to communicate with a third-party web service (eg, from Fedex), but the documentation (ie, web2py book) is awfully skimpy. I'd like to see some examples. I'd like to see a complete description of the API. I want to understand the general procedure for making a SOAP request. Can anyone help? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Delete in SQLFORM.grid does not update number of records
If I delete records in SQLFORM.grid, the number of records does not change. Only if I explicitly refresh the browser page does the number of records change. Have I found a bug? (I'm using web2py 2.9.4.) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] list:string
Well, I added data by using db.update() instead of SQLFORM. The data is definitely in there, and it works. However, in admin, *the data is not visible* in the list:string field (it's empty), so I can't edit it. The behaviour of the list:string data type is very strange. Why is it like that? Or am I doing something wrong? On Thursday, 3 April 2014 02:49:45 UTC-4, Manuele wrote: Il 03/04/14 06:23, horridohobbyist ha scritto: I've added a 'list:string' field to my table, but when adding a new record from admin (using the new record form), I can't figure out how to enter the data. I don't understand what format it expects. I tried ['item1','item2']. I tried |'item1'|'item2'|. They both don't work. Try adding an SQLFORM in a controller, add some data as a user and go as admin to the admin interface and edit data you entered. list:string has a default widget inside SQLFORM that let you enter each item. Hope to be of any help Cheers M. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: list:string
db.define_table('products', Field('thumbnail', 'upload',uploadfield='image_data',represent=lambda v, r: IMG(_src=URL('download',args=v))), Field('image_data', 'blob',readable=False), Field('name',unique=True,represent=lambda v, r: A(v,_href=URL('view',args=[db.products,r.id])) + XML('br'+r.description)), Field('category',represent=lambda v, r: DIV(v,_style='width:75px;word-wrap:break-word;')), Field('description','text',represent=lambda v, r: ''), Field('choices','text',readable=False), Field('shift','list:string',readable=False), I initialize the field with .update(shift=['colour','size']) When I retrieve the field, I indeed can access the list items. However, in admin, I see this: https://lh4.googleusercontent.com/-EfRWKJ_pUWQ/Uz1spRS9D0I/A40/H6TpxX6w7oM/s1600/Screen+Shot+2014-04-03+at+10.08.10+AM.png I know the data is in the field. Why can't I see it?? On Thursday, 3 April 2014 09:37:41 UTC-4, Anthony wrote: Can we see some code (and maybe a screenshot of what you see)? The default list:string widget requires an up-to-date web2py.js file. On Thursday, April 3, 2014 12:23:08 AM UTC-4, horridohobbyist wrote: I've added a 'list:string' field to my table, but when adding a new record from admin (using the new record form), I can't figure out how to enter the data. I don't understand what format it expects. I tried ['item1','item2']. I tried |'item1'|'item2'|. They both don't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: list:string
I upgraded to web2py 2.9.4 recently. Unless the upgrade was corrupted, I should be using the correct files. How can I tell if the web2py.js I have is correct or not? There's no identifying information. On Thursday, 3 April 2014 11:09:07 UTC-4, Anthony wrote: And you're sure you have the version of web2py.js associated with the version of web2py you are running, and that it is loaded on the page? On Thursday, April 3, 2014 10:17:58 AM UTC-4, horridohobbyist wrote: db.define_table('products', Field('thumbnail', 'upload',uploadfield='image_data',represent=lambda v, r: IMG(_src=URL('download',args=v))), Field('image_data', 'blob',readable=False), Field('name',unique=True,represent=lambda v, r: A(v,_href=URL('view',args=[db.products,r.id])) + XML('br'+r.description)), Field('category',represent=lambda v, r: DIV(v,_style='width:75px;word-wrap:break-word;')), Field('description','text',represent=lambda v, r: ''), Field('choices','text',readable=False), Field('shift','list:string',readable=False), I initialize the field with .update(shift=['colour','size']) When I retrieve the field, I indeed can access the list items. However, in admin, I see this: https://lh4.googleusercontent.com/-EfRWKJ_pUWQ/Uz1spRS9D0I/A40/H6TpxX6w7oM/s1600/Screen+Shot+2014-04-03+at+10.08.10+AM.png I know the data is in the field. Why can't I see it?? On Thursday, 3 April 2014 09:37:41 UTC-4, Anthony wrote: Can we see some code (and maybe a screenshot of what you see)? The default list:string widget requires an up-to-date web2py.js file. On Thursday, April 3, 2014 12:23:08 AM UTC-4, horridohobbyist wrote: I've added a 'list:string' field to my table, but when adding a new record from admin (using the new record form), I can't figure out how to enter the data. I don't understand what format it expects. I tried ['item1','item2']. I tried |'item1'|'item2'|. They both don't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: list:string
Done. However, it didn't fix the issue, although I now see a tiny clickable '+' and '-' right beside the input field for 'Shift:'. I have no idea what that means. Clicking on them does nothing. It's also a little disturbing that I have to manually update my apps whenever I upgrade web2py. *This is a disincentive for me to upgrade. My motto is: If it ain't broke, don't fix it.* On Thursday, 3 April 2014 11:55:23 UTC-4, Anthony wrote: While your at it, you may want to copy the appadmin.py controller and appadmin.html views from the new welcome app into your app. Anthony On Thursday, April 3, 2014 11:54:28 AM UTC-4, Anthony wrote: Unless you explicitly copied the new web2py.js file from /welcome/static/js to the /static/js folder of your existing app, then you don't have the updated version of web2py.js. Anthony On Thursday, April 3, 2014 11:47:15 AM UTC-4, horridohobbyist wrote: I upgraded to web2py 2.9.4 recently. Unless the upgrade was corrupted, I should be using the correct files. How can I tell if the web2py.js I have is correct or not? There's no identifying information. On Thursday, 3 April 2014 11:09:07 UTC-4, Anthony wrote: And you're sure you have the version of web2py.js associated with the version of web2py you are running, and that it is loaded on the page? On Thursday, April 3, 2014 10:17:58 AM UTC-4, horridohobbyist wrote: db.define_table('products', Field('thumbnail', 'upload',uploadfield='image_data',represent=lambda v, r: IMG(_src=URL('download',args=v))), Field('image_data', 'blob',readable=False), Field('name',unique=True,represent=lambda v, r: A(v,_href=URL('view',args=[db.products,r.id])) + XML('br'+r.description)), Field('category',represent=lambda v, r: DIV(v,_style='width:75px;word-wrap:break-word;')), Field('description','text',represent=lambda v, r: ''), Field('choices','text',readable=False), Field('shift','list:string',readable=False), I initialize the field with .update(shift=['colour','size']) When I retrieve the field, I indeed can access the list items. However, in admin, I see this: https://lh4.googleusercontent.com/-EfRWKJ_pUWQ/Uz1spRS9D0I/A40/H6TpxX6w7oM/s1600/Screen+Shot+2014-04-03+at+10.08.10+AM.png I know the data is in the field. Why can't I see it?? On Thursday, 3 April 2014 09:37:41 UTC-4, Anthony wrote: Can we see some code (and maybe a screenshot of what you see)? The default list:string widget requires an up-to-date web2py.js file. On Thursday, April 3, 2014 12:23:08 AM UTC-4, horridohobbyist wrote: I've added a 'list:string' field to my table, but when adding a new record from admin (using the new record form), I can't figure out how to enter the data. I don't understand what format it expects. I tried ['item1','item2']. I tried |'item1'|'item2'|. They both don't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: list:string
What and where is the JS console?? On Thursday, 3 April 2014 14:11:02 UTC-4, Anthony wrote: On Thursday, April 3, 2014 12:25:21 PM UTC-4, horridohobbyist wrote: Done. However, it didn't fix the issue, although I now see a tiny clickable '+' and '-' right beside the input field for 'Shift:'. I have no idea what that means. Clicking on them does nothing. Check the JS console to see if any errors are produced. Clicking the + should add a new text box, and clicking the - should remove a box. If existing lists are not being populated, I suppose it's possible that the existing data are not stored correctly in the field. It might help to pack and attach a minimal app that reproduces the problem. It's also a little disturbing that I have to manually update my apps whenever I upgrade web2py. *This is a disincentive for me to upgrade. My motto is: If it ain't broke, don't fix it.* Well, in addition to bringing new features, upgrades typically include bug and security fixes, but if none of those matter to you, then of course you don't have to upgrade. Really, though, is it that much extra work to manually copy a couple of extra files? I think it's not done automatically because technically there does not have to be a fixed name or location for the app files (e.g., you could move or rename web2py.js or combine it with other JS files and minify). Upon upgrade, the only file you really have to worry about is web2py.js (i.e., because that works in conjunction with markup and CSS classes generated by the framework, things might break without the proper version). Old versions of appadmin.py and appadmin.html (and the generic views) should continue to work, though you may be missing new functionality or bug fixes if you don't upgrade those. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: list:string
For some reason, it's suddenly working with the newer web2py.js. Weird. On Thursday, 3 April 2014 14:11:02 UTC-4, Anthony wrote: On Thursday, April 3, 2014 12:25:21 PM UTC-4, horridohobbyist wrote: Done. However, it didn't fix the issue, although I now see a tiny clickable '+' and '-' right beside the input field for 'Shift:'. I have no idea what that means. Clicking on them does nothing. Check the JS console to see if any errors are produced. Clicking the + should add a new text box, and clicking the - should remove a box. If existing lists are not being populated, I suppose it's possible that the existing data are not stored correctly in the field. It might help to pack and attach a minimal app that reproduces the problem. It's also a little disturbing that I have to manually update my apps whenever I upgrade web2py. *This is a disincentive for me to upgrade. My motto is: If it ain't broke, don't fix it.* Well, in addition to bringing new features, upgrades typically include bug and security fixes, but if none of those matter to you, then of course you don't have to upgrade. Really, though, is it that much extra work to manually copy a couple of extra files? I think it's not done automatically because technically there does not have to be a fixed name or location for the app files (e.g., you could move or rename web2py.js or combine it with other JS files and minify). Upon upgrade, the only file you really have to worry about is web2py.js (i.e., because that works in conjunction with markup and CSS classes generated by the framework, things might break without the proper version). Old versions of appadmin.py and appadmin.html (and the generic views) should continue to work, though you may be missing new functionality or bug fixes if you don't upgrade those. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] list:string
I've added a 'list:string' field to my table, but when adding a new record from admin (using the new record form), I can't figure out how to enter the data. I don't understand what format it expects. I tried ['item1','item2']. I tried |'item1'|'item2'|. They both don't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Dynamically Creating a Form
Wow, thanks! Python is pretty amazing. (I come from a largely C background.) On Monday, 31 March 2014 01:06:11 UTC-4, Anthony wrote: Yes, that will do it. form.vars (as well as request.vars and many other web2py objects) is a gluon.storage.Storage object, which is much like a dictionary and allows dictionary-like syntax for accessing items. Similar syntax works with DAL Table and Row objects. Anthony On Monday, March 31, 2014 12:49:37 AM UTC-4, mweissen wrote: Try form.vars['color'] or take a variable v v=color form.vars[v] 2014-03-31 2:32 GMT+02:00 horridohobbyist horrido...@gmail.comjavascript: : But if I create a name such as, for example, color, I'd need to access the form variable thusly: form.vars.color. Since the name was created on the fly, how can I actually say form.vars.color?? If the name was created and stored in a variable, say, x, I can't say form.vars.x. I guess I don't quite understand Python's capabilities. On Sunday, 30 March 2014 20:00:56 UTC-4, Anthony wrote: Well, you need some way to dynamically create names for your fields as well. Figure something out based on whatever you are using to construct the fields themselves. On Sunday, March 30, 2014 7:45:56 PM UTC-4, horridohobbyist wrote: Treating a form like a Python list works like a charm. However, having dynamically added SELECT fields, I don't know how to extract the form.vars for these fields. I don't know how to assign _name in a way that I can reference it after the form has been accepted. For example, elements = [] for b in a: sel = [] for c, val in a[b].iteritems(): sel.append(string.capitalize(c)+':'+str(val)) sel.sort() elements.append(TR(T(string.capitalize(b)),SELECT(sel,_ name=???))) After a form.accepts, I need to access form.vars.??? to get the field selection. But how do I know what the variable name is?? On Saturday, 29 March 2014 09:21:59 UTC-4, Tim Richardson wrote: FORMs are just HTML helpers, so you manipulate them after creating them. You can therefore just treat them like python lists, but there is functionality which may be more helpful: http://web2py.com/books/default/chapter/29/05/the- views#Server-side-DOM-and-parsing On Sunday, 30 March 2014 00:11:27 UTC+11, horridohobbyist wrote: Is there a way for me to dynamically add form elements, such as INPUT fields or SELECT fields, to a form? I'm not sure how to do this. I'd like to add these elements only under certain conditions. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Dynamically Creating a Form
Treating a form like a Python list works like a charm. However, having dynamically added SELECT fields, I don't know how to extract the form.vars for these fields. I don't know how to assign _name in a way that I can reference it after the form has been accepted. For example, elements = [] for b in a: sel = [] for c, val in a[b].iteritems(): sel.append(string.capitalize(c)+':'+str(val)) sel.sort() elements.append(TR(T(string.capitalize(b)),SELECT(sel,_name=???))) After a form.accepts, I need to access form.vars.??? to get the field selection. But how do I know what the variable name is?? On Saturday, 29 March 2014 09:21:59 UTC-4, Tim Richardson wrote: FORMs are just HTML helpers, so you manipulate them after creating them. You can therefore just treat them like python lists, but there is functionality which may be more helpful: http://web2py.com/books/default/chapter/29/05/the-views#Server-side-DOM-and-parsing On Sunday, 30 March 2014 00:11:27 UTC+11, horridohobbyist wrote: Is there a way for me to dynamically add form elements, such as INPUT fields or SELECT fields, to a form? I'm not sure how to do this. I'd like to add these elements only under certain conditions. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Dynamically Creating a Form
But if I create a name such as, for example, color, I'd need to access the form variable thusly: form.vars.color. Since the name was created on the fly, how can I actually say form.vars.color?? If the name was created and stored in a variable, say, x, I can't say form.vars.x. I guess I don't quite understand Python's capabilities. On Sunday, 30 March 2014 20:00:56 UTC-4, Anthony wrote: Well, you need some way to dynamically create names for your fields as well. Figure something out based on whatever you are using to construct the fields themselves. On Sunday, March 30, 2014 7:45:56 PM UTC-4, horridohobbyist wrote: Treating a form like a Python list works like a charm. However, having dynamically added SELECT fields, I don't know how to extract the form.vars for these fields. I don't know how to assign _name in a way that I can reference it after the form has been accepted. For example, elements = [] for b in a: sel = [] for c, val in a[b].iteritems(): sel.append(string.capitalize(c)+':'+str(val)) sel.sort() elements.append(TR(T(string.capitalize(b)),SELECT(sel,_name=???))) After a form.accepts, I need to access form.vars.??? to get the field selection. But how do I know what the variable name is?? On Saturday, 29 March 2014 09:21:59 UTC-4, Tim Richardson wrote: FORMs are just HTML helpers, so you manipulate them after creating them. You can therefore just treat them like python lists, but there is functionality which may be more helpful: http://web2py.com/books/default/chapter/29/05/the-views#Server-side-DOM-and-parsing On Sunday, 30 March 2014 00:11:27 UTC+11, horridohobbyist wrote: Is there a way for me to dynamically add form elements, such as INPUT fields or SELECT fields, to a form? I'm not sure how to do this. I'd like to add these elements only under certain conditions. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Dynamically Creating a Form
Is there a way for me to dynamically add form elements, such as INPUT fields or SELECT fields, to a form? I'm not sure how to do this. I'd like to add these elements only under certain conditions. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: jQuery load no longer working
Sorry, bad transcription. The original code had the correct parentheses. Anyway, I found out what was wrong. I was trying to incorporate colorbox (a variation of jQuery's lightbox) and I included a different jquery.min.js. Apparently, this conflicted with web2py's jQuery. On Tuesday, 25 March 2014 02:34:13 UTC-4, Massimo Di Pierro wrote: Missing a ) On Monday, 24 March 2014 21:49:51 UTC-5, horridohobbyist wrote: I have a strange issue. I had code that includes an external HTML file. It used to work. Lately, it suddenly no longer works. I've isolated the code and put it into my Welcome program. I am unable to figure out what's wrong. script $(function(){ $(#includedContent).load(/welcome/static/desc.html); }; /script div id='includedContent'Put included content here./div Since the Welcome application includes jQuery, this ought to work, right? And it did work in my development project. So what's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Searching an undisplayed column
I have a field called 'description'. In SQLFORM.grid, I do NOT want to display the 'description' field, but I do want to be able to search the 'description' field from the grid's search function. Is there a way to do this? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Searching an undisplayed column
I tried that, but it doesn't work. I solved it by letting the field be readable and hiding it with description.label=' ' and represent=lambda v,r: ''. Not particularly elegant, but it gets the job done. Of course, the search dropdown includes the ' ' label, but it's not a big deal. On Monday, 24 March 2014 07:48:37 UTC-4, Anthony wrote: What does your code look like? I think all readable fields are searchable, so maybe you could make the field readable and hide it by using the fields argument to list the fields to be displayed. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] jQuery load no longer working
I have a strange issue. I had code that includes an external HTML file. It used to work. Lately, it suddenly no longer works. I've isolated the code and put it into my Welcome program. I am unable to figure out what's wrong. script $(function(){ $(#includedContent).load(/welcome/static/desc.html); }; /script div id='includedContent'Put included content here./div Since the Welcome application includes jQuery, this ought to work, right? And it did work in my development project. So what's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
Something very strange is going on. After I've run the Welcome test where the results are consistently fast (ie, ~1.6 seconds), if I wait an hour or so and run the test again, I get something like the following: Begin... Elapsed time: 97.1873888969 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.63321781158 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.2418119907 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.62313604355 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.3058979511 Percentage fill: 41.9664268585 The first run is ENORMOUSLY slow. Subsequently, the runtimes alternate between fast and slow (ie, 1.6 seconds vs 13 seconds). To reiterate: This happens if I give the server lots of time before I resume testing. Please note that nothing much else is happening on the server; it gets very little traffic. If I restart Apache, then I get back to the initial situation where the results are consistently fast. *This pattern is repeatable*. FYI, I'm using processes=2 and threads=1. On Thursday, 20 March 2014 11:34:03 UTC-4, horridohobbyist wrote: processes=1 and threads=30 also seems to solve the performance problem. BTW, I'm having a dickens of a time reproducing the problem in my servers (either the actual server or the VM). I have not been able to discover how to reset the state of my tests, so I have to blindly go around trying to reproduce the problem. I thought it might be a caching problem in the browser, but clearing the browser cache doesn't seem to reset the state. Restarting Apache doesn't always reset the state, either. Restarting the browser doesn't reset the state. In desperation, I've even tried rebooting the systems. Nada. This is very frustrating. I shall have to continue my investigation before coming to a definitive conclusion. On Wednesday, 19 March 2014 21:06:02 UTC-4, Tim Richardson wrote: Try threads = 30 or 50 or 100; that would be interesting. Every request which is routed through web2py will try to start a new thread. Every web page will potentially generate multiple requests (for assets like images, scripts etc). So you can potentially need a lot of threads. When you started two processes, you may not have specified threads which meant you had a pool of 30 threads (and then you saw better performance). Using few threads than that isn't going to conclude very much, I think. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
Scratch my solution. It's not correct. My test results are all over the place. You don't even have to wait an hour. Within the span of 15 minutes, I've gone from fast, fast, fast, fast, fast, fast to super-slow (90+ seconds), super-slow to slow, slow, slow, slow. The variability seems to be pseudo-random. I should also mention that threads=30 doesn't always work. This is probably part of the pseudo-random nature of the problem. I don't think the solution lies in configuring processes and threads in the Apache web2py configuration. At this point, I don't know what else to do or try. On Saturday, 22 March 2014 11:01:16 UTC-4, horridohobbyist wrote: Something very strange is going on. After I've run the Welcome test where the results are consistently fast (ie, ~1.6 seconds), if I wait an hour or so and run the test again, I get something like the following: Begin... Elapsed time: 97.1873888969 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.63321781158 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.2418119907 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.62313604355 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.3058979511 Percentage fill: 41.9664268585 The first run is ENORMOUSLY slow. Subsequently, the runtimes alternate between fast and slow (ie, 1.6 seconds vs 13 seconds). To reiterate: This happens if I give the server lots of time before I resume testing. Please note that nothing much else is happening on the server; it gets very little traffic. If I restart Apache, then I get back to the initial situation where the results are consistently fast. *This pattern is repeatable*. FYI, I'm using processes=2 and threads=1. On Thursday, 20 March 2014 11:34:03 UTC-4, horridohobbyist wrote: processes=1 and threads=30 also seems to solve the performance problem. BTW, I'm having a dickens of a time reproducing the problem in my servers (either the actual server or the VM). I have not been able to discover how to reset the state of my tests, so I have to blindly go around trying to reproduce the problem. I thought it might be a caching problem in the browser, but clearing the browser cache doesn't seem to reset the state. Restarting Apache doesn't always reset the state, either. Restarting the browser doesn't reset the state. In desperation, I've even tried rebooting the systems. Nada. This is very frustrating. I shall have to continue my investigation before coming to a definitive conclusion. On Wednesday, 19 March 2014 21:06:02 UTC-4, Tim Richardson wrote: Try threads = 30 or 50 or 100; that would be interesting. Every request which is routed through web2py will try to start a new thread. Every web page will potentially generate multiple requests (for assets like images, scripts etc). So you can potentially need a lot of threads. When you started two processes, you may not have specified threads which meant you had a pool of 30 threads (and then you saw better performance). Using few threads than that isn't going to conclude very much, I think. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
Well, according to the 'free' command, even when I'm getting these slowdowns, I'm nowhere close to the memory limits: total used free shared buffers cached Mem: 39252443929003532344 0 23608 123856 Like I said, my Linux server doesn't do much. It doesn't get much traffic, either. So it has plenty of free memory. On Saturday, 22 March 2014 12:49:21 UTC-4, Massimo Di Pierro wrote: Have you checked memory consumption? On Saturday, 22 March 2014 10:15:59 UTC-5, horridohobbyist wrote: Scratch my solution. It's not correct. My test results are all over the place. You don't even have to wait an hour. Within the span of 15 minutes, I've gone from fast, fast, fast, fast, fast, fast to super-slow (90+ seconds), super-slow to slow, slow, slow, slow. The variability seems to be pseudo-random. I should also mention that threads=30 doesn't always work. This is probably part of the pseudo-random nature of the problem. I don't think the solution lies in configuring processes and threads in the Apache web2py configuration. At this point, I don't know what else to do or try. On Saturday, 22 March 2014 11:01:16 UTC-4, horridohobbyist wrote: Something very strange is going on. After I've run the Welcome test where the results are consistently fast (ie, ~1.6 seconds), if I wait an hour or so and run the test again, I get something like the following: Begin... Elapsed time: 97.1873888969 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.63321781158 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.2418119907 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.62313604355 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.3058979511 Percentage fill: 41.9664268585 The first run is ENORMOUSLY slow. Subsequently, the runtimes alternate between fast and slow (ie, 1.6 seconds vs 13 seconds). To reiterate: This happens if I give the server lots of time before I resume testing. Please note that nothing much else is happening on the server; it gets very little traffic. If I restart Apache, then I get back to the initial situation where the results are consistently fast. *This pattern is repeatable*. FYI, I'm using processes=2 and threads=1. On Thursday, 20 March 2014 11:34:03 UTC-4, horridohobbyist wrote: processes=1 and threads=30 also seems to solve the performance problem. BTW, I'm having a dickens of a time reproducing the problem in my servers (either the actual server or the VM). I have not been able to discover how to reset the state of my tests, so I have to blindly go around trying to reproduce the problem. I thought it might be a caching problem in the browser, but clearing the browser cache doesn't seem to reset the state. Restarting Apache doesn't always reset the state, either. Restarting the browser doesn't reset the state. In desperation, I've even tried rebooting the systems. Nada. This is very frustrating. I shall have to continue my investigation before coming to a definitive conclusion. On Wednesday, 19 March 2014 21:06:02 UTC-4, Tim Richardson wrote: Try threads = 30 or 50 or 100; that would be interesting. Every request which is routed through web2py will try to start a new thread. Every web page will potentially generate multiple requests (for assets like images, scripts etc). So you can potentially need a lot of threads. When you started two processes, you may not have specified threads which meant you had a pool of 30 threads (and then you saw better performance). Using few threads than that isn't going to conclude very much, I think. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
I'm considering delving into DTrace to find out what's going on, but any such instrumentation is apparently very problematic in Linux (eg, poor support, poor documentation, etc.). Is there any other way to find out what the hell is going on? On Saturday, 22 March 2014 16:24:20 UTC-4, horridohobbyist wrote: Well, according to the 'free' command, even when I'm getting these slowdowns, I'm nowhere close to the memory limits: total used free shared buffers cached Mem: 39252443929003532344 0 23608 123856 Like I said, my Linux server doesn't do much. It doesn't get much traffic, either. So it has plenty of free memory. On Saturday, 22 March 2014 12:49:21 UTC-4, Massimo Di Pierro wrote: Have you checked memory consumption? On Saturday, 22 March 2014 10:15:59 UTC-5, horridohobbyist wrote: Scratch my solution. It's not correct. My test results are all over the place. You don't even have to wait an hour. Within the span of 15 minutes, I've gone from fast, fast, fast, fast, fast, fast to super-slow (90+ seconds), super-slow to slow, slow, slow, slow. The variability seems to be pseudo-random. I should also mention that threads=30 doesn't always work. This is probably part of the pseudo-random nature of the problem. I don't think the solution lies in configuring processes and threads in the Apache web2py configuration. At this point, I don't know what else to do or try. On Saturday, 22 March 2014 11:01:16 UTC-4, horridohobbyist wrote: Something very strange is going on. After I've run the Welcome test where the results are consistently fast (ie, ~1.6 seconds), if I wait an hour or so and run the test again, I get something like the following: Begin... Elapsed time: 97.1873888969 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.63321781158 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.2418119907 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.62313604355 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.3058979511 Percentage fill: 41.9664268585 The first run is ENORMOUSLY slow. Subsequently, the runtimes alternate between fast and slow (ie, 1.6 seconds vs 13 seconds). To reiterate: This happens if I give the server lots of time before I resume testing. Please note that nothing much else is happening on the server; it gets very little traffic. If I restart Apache, then I get back to the initial situation where the results are consistently fast. *This pattern is repeatable*. FYI, I'm using processes=2 and threads=1. On Thursday, 20 March 2014 11:34:03 UTC-4, horridohobbyist wrote: processes=1 and threads=30 also seems to solve the performance problem. BTW, I'm having a dickens of a time reproducing the problem in my servers (either the actual server or the VM). I have not been able to discover how to reset the state of my tests, so I have to blindly go around trying to reproduce the problem. I thought it might be a caching problem in the browser, but clearing the browser cache doesn't seem to reset the state. Restarting Apache doesn't always reset the state, either. Restarting the browser doesn't reset the state. In desperation, I've even tried rebooting the systems. Nada. This is very frustrating. I shall have to continue my investigation before coming to a definitive conclusion. On Wednesday, 19 March 2014 21:06:02 UTC-4, Tim Richardson wrote: Try threads = 30 or 50 or 100; that would be interesting. Every request which is routed through web2py will try to start a new thread. Every web page will potentially generate multiple requests (for assets like images, scripts etc). So you can potentially need a lot of threads. When you started two processes, you may not have specified threads which meant you had a pool of 30 threads (and then you saw better performance). Using few threads than that isn't going to conclude very much, I think. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
I don't understand why the Flask version of the Welcome test doesn't exhibit this slowdown under Apache. It's executing the same application code. It's configured with the same processes=1 and threads=1 WSGI parameters. It's running the same Python interpreter (and presumably using the same GIL). I'm not sure it's entirely Apache's fault. I suspect it's in the *interaction* between Apache and web2py. The interaction between Apache and Flask seems to avoid this problem. However, I am ill-equipped to follow up on this. On Saturday, 22 March 2014 16:28:22 UTC-4, horridohobbyist wrote: I'm considering delving into DTrace to find out what's going on, but any such instrumentation is apparently very problematic in Linux (eg, poor support, poor documentation, etc.). Is there any other way to find out what the hell is going on? On Saturday, 22 March 2014 16:24:20 UTC-4, horridohobbyist wrote: Well, according to the 'free' command, even when I'm getting these slowdowns, I'm nowhere close to the memory limits: total used free shared buffers cached Mem: 39252443929003532344 0 23608 123856 Like I said, my Linux server doesn't do much. It doesn't get much traffic, either. So it has plenty of free memory. On Saturday, 22 March 2014 12:49:21 UTC-4, Massimo Di Pierro wrote: Have you checked memory consumption? On Saturday, 22 March 2014 10:15:59 UTC-5, horridohobbyist wrote: Scratch my solution. It's not correct. My test results are all over the place. You don't even have to wait an hour. Within the span of 15 minutes, I've gone from fast, fast, fast, fast, fast, fast to super-slow (90+ seconds), super-slow to slow, slow, slow, slow. The variability seems to be pseudo-random. I should also mention that threads=30 doesn't always work. This is probably part of the pseudo-random nature of the problem. I don't think the solution lies in configuring processes and threads in the Apache web2py configuration. At this point, I don't know what else to do or try. On Saturday, 22 March 2014 11:01:16 UTC-4, horridohobbyist wrote: Something very strange is going on. After I've run the Welcome test where the results are consistently fast (ie, ~1.6 seconds), if I wait an hour or so and run the test again, I get something like the following: Begin... Elapsed time: 97.1873888969 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.63321781158 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.2418119907 Percentage fill: 41.9664268585 Begin... Elapsed time: 1.62313604355 Percentage fill: 41.9664268585 Begin... Elapsed time: 13.3058979511 Percentage fill: 41.9664268585 The first run is ENORMOUSLY slow. Subsequently, the runtimes alternate between fast and slow (ie, 1.6 seconds vs 13 seconds). To reiterate: This happens if I give the server lots of time before I resume testing. Please note that nothing much else is happening on the server; it gets very little traffic. If I restart Apache, then I get back to the initial situation where the results are consistently fast. *This pattern is repeatable*. FYI, I'm using processes=2 and threads=1. On Thursday, 20 March 2014 11:34:03 UTC-4, horridohobbyist wrote: processes=1 and threads=30 also seems to solve the performance problem. BTW, I'm having a dickens of a time reproducing the problem in my servers (either the actual server or the VM). I have not been able to discover how to reset the state of my tests, so I have to blindly go around trying to reproduce the problem. I thought it might be a caching problem in the browser, but clearing the browser cache doesn't seem to reset the state. Restarting Apache doesn't always reset the state, either. Restarting the browser doesn't reset the state. In desperation, I've even tried rebooting the systems. Nada. This is very frustrating. I shall have to continue my investigation before coming to a definitive conclusion. On Wednesday, 19 March 2014 21:06:02 UTC-4, Tim Richardson wrote: Try threads = 30 or 50 or 100; that would be interesting. Every request which is routed through web2py will try to start a new thread. Every web page will potentially generate multiple requests (for assets like images, scripts etc). So you can potentially need a lot of threads. When you started two processes, you may not have specified threads which meant you had a pool of 30 threads (and then you saw better performance). Using few threads than that isn't going to conclude very much, I think. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send
[web2py] Re: web2py 2.9.5 is OUT
I always have trouble upgrading from the Administrative Interface; it always complains about permissions. This is under Linux. Is it because web2py doesn't have sudo permission? Anyway, what's the safest way to manually install over my existing installation? Thanks. On Saturday, 15 March 2014 22:42:14 UTC-4, Massimo Di Pierro wrote: Contains major bug fixes. Thanks niphlod, Tim, all the other who have contributed. Massimo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
processes=1 and threads=30 also seems to solve the performance problem. BTW, I'm having a dickens of a time reproducing the problem in my servers (either the actual server or the VM). I have not been able to discover how to reset the state of my tests, so I have to blindly go around trying to reproduce the problem. I thought it might be a caching problem in the browser, but clearing the browser cache doesn't seem to reset the state. Restarting Apache doesn't always reset the state, either. Restarting the browser doesn't reset the state. In desperation, I've even tried rebooting the systems. Nada. This is very frustrating. I shall have to continue my investigation before coming to a definitive conclusion. On Wednesday, 19 March 2014 21:06:02 UTC-4, Tim Richardson wrote: Try threads = 30 or 50 or 100; that would be interesting. Every request which is routed through web2py will try to start a new thread. Every web page will potentially generate multiple requests (for assets like images, scripts etc). So you can potentially need a lot of threads. When you started two processes, you may not have specified threads which meant you had a pool of 30 threads (and then you saw better performance). Using few threads than that isn't going to conclude very much, I think. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
Yes, processes=3 and threads=1. I tried processes=1 and threads=3, and performance was still 10x bad. So I guess that answers my question: the threads parameter is not helpful. On Wednesday, 19 March 2014 05:24:01 UTC-4, Tim Richardson wrote: Did you explicitly set the number of threads as well? By default you get 15 threads per process. The documentation implies that this is a hard limit, but I'm not sure. Maybe you have simply found a bottleneck in threads. Did you also try increasing the number of threads instead of adding more processes? Multi-threaded apache is supposed to be faster than multi-process apache under real load (i.e. multiple users) because starting (and switching) processes is expensive in time and memory.* So any conclusion that you need more processes is dubious, I think. I can't recall how many simultaneous users your benchmarking is testing. Bear in mind that the fastest servers, the greenlet or co-operative async servers, are not only limited to one process, but even to one thread. http://nichol.as/benchmark-of-python-web-servers On Wednesday, 19 March 2014 14:25:47 UTC+11, horridohobbyist wrote: I shall do that. Thanks. With the knowledge about processes=, I've tuned my actual Linux server to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core Xeon with 4GB RAM, processes=2 works best. I found that any other value (3, 4, 5) gave very inconsistent results–sometimes I would get 1x (the ideal) and sometimes I would get 10x. Very bizarre. processes=2 is counter-intuitive. After all, I have 4 cores. Why shouldn't processes=4 be good? Anyway, not only is the shipping code fast, but I find that my overall web2py app feels a lot snappier. Is it just my imagination? If processes=2 is boosting the speed of Python in general, then you would expect all of web2py to benefit. So maybe it's not my imagination. Anyway, the takeaway, I think, is that you must tune the Apache configuration for the particular server hardware that you have. The default processes=1 is not good enough. On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote: Thank you for all your tests. You should write a summary of your results with recommendations for Apache users. On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote: Done. With processes=3, the 10x discrepancy is eliminated! (And this is in a Linux VM configured for 1 CPU.) On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote: WSGIDaemonProcess hello user=www-data group=www-data threads=5 with web2py try the following instead: WSGIDaemonProcess hello user=www-data group=www-data processes=number of cores + 1 threads=(0 or 1) If it's faster, then the GIL must be the cause. flask by default has much less features active (session for instance) 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com: I took the shipping code that I ran in Flask (without Apache) and adapted it to run under Apache as a Flask app. That way, I'm comparing apples to apples. I'm comparing the performance of the shipping code between Flask and web2py. Below, I've included the 'default' file from Apache2/sites-available for Flask. Basically, the code in Flask executes 10x faster than the same code in web2py. So my question is: if Apache is at fault for the web2py app's slow performance, why doesn't Apache hurt the Flask app's performance? (This doesn't seem to be related to GIL or WSGI.) VirtualHost *:80 ServerName 10.211.55.7 WSGIDaemonProcess hello user=www-data group=www-data threads=5 WSGIScriptAlias / /home/richard/welcome/hello.wsgi Directory /home/richard/welcome Order Allow,Deny Allow from all /Directory /VirtualHost -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
In 2007, I wrote my first web application using Smalltalk/Seaside. I chose Seaside because it was a very easy-to-learn, easy-to-program, easy-to-deploy, highly productive, self-contained all-in-one web framework. (It still is, today.) Unfortunately, web2py hadn't been born yet, but clearly the two frameworks had similar goals. (Born in 2002, Seaside has 5 years over web2py.) I deployed the Seaside app under Apache on the same hardware that I'm using today for web2py. Yes, my 2.4GHz quad-core Xeon Dell server with 4GB RAM is over 7 years old!! Recently, I switched over to web2py because I had heard so many good things about it. I can now say that web2py is far superior to Seaside. It's even more easy-to-learn and easy-to-program; it's even more productive. And Seaside was pretty darn good in this respect! I believe web2py is the best available web framework in the world today, regardless of language (ie, Java, Ruby, PHP, etc.). I am 100% in agreement with its philosophy and goals. Please, keep up the good work! On Wednesday, 19 March 2014 07:27:54 UTC-4, horridohobbyist wrote: Yes, processes=3 and threads=1. I tried processes=1 and threads=3, and performance was still 10x bad. So I guess that answers my question: the threads parameter is not helpful. On Wednesday, 19 March 2014 05:24:01 UTC-4, Tim Richardson wrote: Did you explicitly set the number of threads as well? By default you get 15 threads per process. The documentation implies that this is a hard limit, but I'm not sure. Maybe you have simply found a bottleneck in threads. Did you also try increasing the number of threads instead of adding more processes? Multi-threaded apache is supposed to be faster than multi-process apache under real load (i.e. multiple users) because starting (and switching) processes is expensive in time and memory.* So any conclusion that you need more processes is dubious, I think. I can't recall how many simultaneous users your benchmarking is testing. Bear in mind that the fastest servers, the greenlet or co-operative async servers, are not only limited to one process, but even to one thread. http://nichol.as/benchmark-of-python-web-servers On Wednesday, 19 March 2014 14:25:47 UTC+11, horridohobbyist wrote: I shall do that. Thanks. With the knowledge about processes=, I've tuned my actual Linux server to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core Xeon with 4GB RAM, processes=2 works best. I found that any other value (3, 4, 5) gave very inconsistent results–sometimes I would get 1x (the ideal) and sometimes I would get 10x. Very bizarre. processes=2 is counter-intuitive. After all, I have 4 cores. Why shouldn't processes=4 be good? Anyway, not only is the shipping code fast, but I find that my overall web2py app feels a lot snappier. Is it just my imagination? If processes=2 is boosting the speed of Python in general, then you would expect all of web2py to benefit. So maybe it's not my imagination. Anyway, the takeaway, I think, is that you must tune the Apache configuration for the particular server hardware that you have. The default processes=1 is not good enough. On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote: Thank you for all your tests. You should write a summary of your results with recommendations for Apache users. On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote: Done. With processes=3, the 10x discrepancy is eliminated! (And this is in a Linux VM configured for 1 CPU.) On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote: WSGIDaemonProcess hello user=www-data group=www-data threads=5 with web2py try the following instead: WSGIDaemonProcess hello user=www-data group=www-data processes=number of cores + 1 threads=(0 or 1) If it's faster, then the GIL must be the cause. flask by default has much less features active (session for instance) 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com: I took the shipping code that I ran in Flask (without Apache) and adapted it to run under Apache as a Flask app. That way, I'm comparing apples to apples. I'm comparing the performance of the shipping code between Flask and web2py. Below, I've included the 'default' file from Apache2/sites-available for Flask. Basically, the code in Flask executes 10x faster than the same code in web2py. So my question is: if Apache is at fault for the web2py app's slow performance, why doesn't Apache hurt the Flask app's performance? (This doesn't seem to be related to GIL or WSGI.) VirtualHost *:80 ServerName 10.211.55.7 WSGIDaemonProcess hello user=www-data group=www-data threads=5 WSGIScriptAlias / /home/richard/welcome/hello.wsgi Directory /home/richard/welcome Order Allow,Deny Allow from all /Directory /VirtualHost
[web2py] Python Performance Issue, Part 2
I took the shipping code that I ran in Flask (without Apache) and adapted it to run under Apache as a Flask app. That way, I'm comparing apples to apples. I'm comparing the performance of the shipping code between Flask and web2py. Below, I've included the 'default' file from Apache2/sites-available for Flask. Basically, the code in Flask executes 10x faster than the same code in web2py. So my question is: if Apache is at fault for the web2py app's slow performance, why doesn't Apache hurt the Flask app's performance? (This doesn't seem to be related to GIL or WSGI.) VirtualHost *:80 ServerName 10.211.55.7 WSGIDaemonProcess hello user=www-data group=www-data threads=5 WSGIScriptAlias / /home/richard/welcome/hello.wsgi Directory /home/richard/welcome Order Allow,Deny Allow from all /Directory /VirtualHost -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. 430x300x200 430x300x200 400x370x330 390x285x140 585x285x200 430x300x200 400x370x330 553x261x152 290x210x160 390x285x140 debug.out Description: Binary data from flask import Flask app = Flask(__name__) import time import sys import os debug_path = '/home/richard/welcome/debug.out' def debug(str): f = open(debug_path,'a') f.write(str+'\n') f.close() return # # pyShipping 1.8a # import time import random from shippackage import Package def packstrip(bin, p): Creates a Strip which fits into bin. Returns the Packages to be used in the strip, the dimensions of the strip as a 3-tuple and a list of left over packages. # This code is somewhat optimized and somewhat unreadable s = []# strip r = []# rest ss = sw = sl = 0 # stripsize bs = bin.heigth # binsize sapp = s.append # speedup rapp = r.append # speedup ppop = p.pop # speedup while p and (ss = bs): n = ppop(0) nh, nw, nl = n.size if ss + nh = bs: ss += nh sapp(n) if nw sw: sw = nw if nl sl: sl = nl else: rapp(n) return s, (ss, sw, sl), r + p def packlayer(bin, packages): strips = [] layersize = 0 layerx = 0 layery = 0 binsize = bin.width while packages: strip, (sizex, stripsize, sizez), rest = packstrip(bin, packages) if layersize + stripsize = binsize: if not strip: # we were not able to pack anything break layersize += stripsize layerx = max([sizex, layerx]) layery = max([sizez, layery]) strips.extend(strip) packages = rest else: # Next Layer please packages = strip + rest break return strips, (layerx, layersize, layery), packages def packbin(bin, packages): packages.sort() layers = [] contentheigth = 0 contentx = 0 contenty = 0 binsize = bin.length while packages: layer, (sizex, sizey, layersize), rest = packlayer(bin, packages) if contentheigth + layersize = binsize: if not layer: # we were not able to pack anything break contentheigth += layersize contentx = max([contentx, sizex]) contenty = max([contenty, sizey]) layers.extend(layer) packages = rest else: # Next Bin please packages = layer + rest break return layers, (contentx, contenty, contentheigth), packages def packit(bin, originalpackages): packedbins = [] packages = sorted(originalpackages) while packages: packagesinbin, (binx, biny, binz), rest = packbin(bin, packages) if not packagesinbin: # we were not able to pack anything break packedbins.append(packagesinbin) packages = rest # we now have a result, try to get a better result by rotating some bins return packedbins, rest # In newer Python versions these van be imported: # from itertools import permutations def product(*args, **kwds): # product('ABCD', 'xy') -- Ax Ay Bx By Cx Cy Dx Dy # product(range(2), repeat=3) -- 000 001 010 011 100 101 110 111 pools = map(tuple, args) * kwds.get('repeat', 1) result = [[]] for pool in pools: result = [x + [y] for x in result for y in pool] for prod in result: yield tuple(prod) def permutations(iterable, r=None): pool = tuple(iterable) n =
Re: [web2py] Python Performance Issue, Part 2
Done. With processes=3, the 10x discrepancy is eliminated! (And this is in a Linux VM configured for 1 CPU.) On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote: WSGIDaemonProcess hello user=www-data group=www-data threads=5 with web2py try the following instead: WSGIDaemonProcess hello user=www-data group=www-data processes=number of cores + 1 threads=(0 or 1) If it's faster, then the GIL must be the cause. flask by default has much less features active (session for instance) 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.comjavascript:: I took the shipping code that I ran in Flask (without Apache) and adapted it to run under Apache as a Flask app. That way, I'm comparing apples to apples. I'm comparing the performance of the shipping code between Flask and web2py. Below, I've included the 'default' file from Apache2/sites-available for Flask. Basically, the code in Flask executes 10x faster than the same code in web2py. So my question is: if Apache is at fault for the web2py app's slow performance, why doesn't Apache hurt the Flask app's performance? (This doesn't seem to be related to GIL or WSGI.) VirtualHost *:80 ServerName 10.211.55.7 WSGIDaemonProcess hello user=www-data group=www-data threads=5 WSGIScriptAlias / /home/richard/welcome/hello.wsgi Directory /home/richard/welcome Order Allow,Deny Allow from all /Directory /VirtualHost -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
I shall do that. Thanks. With the knowledge about processes=, I've tuned my actual Linux server to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core Xeon with 4GB RAM, processes=2 works best. I found that any other value (3, 4, 5) gave very inconsistent results–sometimes I would get 1x (the ideal) and sometimes I would get 10x. Very bizarre. processes=2 is counter-intuitive. After all, I have 4 cores. Why shouldn't processes=4 be good? Anyway, not only is the shipping code fast, but I find that my overall web2py app feels a lot snappier. Is it just my imagination? If processes=2 is boosting the speed of Python in general, then you would expect all of web2py to benefit. So maybe it's not my imagination. Anyway, the takeaway, I think, is that you must tune the Apache configuration for the particular server hardware that you have. The default processes=1 is not good enough. On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote: Thank you for all your tests. You should write a summary of your results with recommendations for Apache users. On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote: Done. With processes=3, the 10x discrepancy is eliminated! (And this is in a Linux VM configured for 1 CPU.) On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote: WSGIDaemonProcess hello user=www-data group=www-data threads=5 with web2py try the following instead: WSGIDaemonProcess hello user=www-data group=www-data processes=number of cores + 1 threads=(0 or 1) If it's faster, then the GIL must be the cause. flask by default has much less features active (session for instance) 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com: I took the shipping code that I ran in Flask (without Apache) and adapted it to run under Apache as a Flask app. That way, I'm comparing apples to apples. I'm comparing the performance of the shipping code between Flask and web2py. Below, I've included the 'default' file from Apache2/sites-available for Flask. Basically, the code in Flask executes 10x faster than the same code in web2py. So my question is: if Apache is at fault for the web2py app's slow performance, why doesn't Apache hurt the Flask app's performance? (This doesn't seem to be related to GIL or WSGI.) VirtualHost *:80 ServerName 10.211.55.7 WSGIDaemonProcess hello user=www-data group=www-data threads=5 WSGIScriptAlias / /home/richard/welcome/hello.wsgi Directory /home/richard/welcome Order Allow,Deny Allow from all /Directory /VirtualHost -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue, Part 2
threads=0 is no good–Apache restart upchucks on this. BTW, I haven't experimented with the threads value. Might this also improve performance (with respect to GIL)? Also, I was wondering. Is the processes= solution related to whether you are using the prefork MPM or the worker MPM? I know that Apache is normally compiled to use the prefork MPM. On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote: WSGIDaemonProcess hello user=www-data group=www-data threads=5 with web2py try the following instead: WSGIDaemonProcess hello user=www-data group=www-data processes=number of cores + 1 threads=(0 or 1) If it's faster, then the GIL must be the cause. flask by default has much less features active (session for instance) 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.comjavascript:: I took the shipping code that I ran in Flask (without Apache) and adapted it to run under Apache as a Flask app. That way, I'm comparing apples to apples. I'm comparing the performance of the shipping code between Flask and web2py. Below, I've included the 'default' file from Apache2/sites-available for Flask. Basically, the code in Flask executes 10x faster than the same code in web2py. So my question is: if Apache is at fault for the web2py app's slow performance, why doesn't Apache hurt the Flask app's performance? (This doesn't seem to be related to GIL or WSGI.) VirtualHost *:80 ServerName 10.211.55.7 WSGIDaemonProcess hello user=www-data group=www-data threads=5 WSGIScriptAlias / /home/richard/welcome/hello.wsgi Directory /home/richard/welcome Order Allow,Deny Allow from all /Directory /VirtualHost -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
Parallels VM running on a 2.5GHz dual-core Mac mini. I really don't know what Parallels uses. On Monday, 17 March 2014 00:05:58 UTC-4, Massimo Di Pierro wrote: What kind of VM is this? What is the host platform? How many CPU cores? Is VM using all the cores? The only thing I can think of is the GIL and the fact that multithreaded code in python gets slower and slower the more cores I have. On my laptop, with two cores, I do not see any slow down. Rocket preallocate a thread pool. The rationale is that it decreases the latency time. Perhaps you can also try rocket in this way: web2py.py --minthreads=1 --maxthreads=1 This will reduce the number of worker threads to 1. Rocket also runs a background non-worker thread that monitors worker threads and kills them if they get stuck. On Sunday, 16 March 2014 20:22:45 UTC-5, horridohobbyist wrote: Using gunicorn (Thanks, Massimo), I ran the full web2py Welcome code: Welcome: elapsed time: 0.0511929988861 Welcome: elapsed time: 0.0024790763855 Welcome: elapsed time: 0.00262713432312 Welcome: elapsed time: 0.00224614143372 Welcome: elapsed time: 0.00218415260315 Welcome: elapsed time: 0.00213503837585 Oddly enough, it's slightly faster! But still 37% slower than the command line execution. I'd really, really, **really** like to know why the shipping code is 10x slower... On Sunday, 16 March 2014 21:13:56 UTC-4, horridohobbyist wrote: Okay, I did the calculations test in my Linux VM using command line (fred0), Flask (hello0), and web2py (Welcome). fred0: elapsed time: 0.00159001350403 fred0: elapsed time: 0.0015709400177 fred0: elapsed time: 0.00156021118164 fred0: elapsed time: 0.0015971660614 fred0: elapsed time: 0.0031584741 hello0: elapsed time: 0.00271105766296 hello0: elapsed time: 0.00213503837585 hello0: elapsed time: 0.00195693969727 hello0: elapsed time: 0.00224900245667 hello0: elapsed time: 0.00205492973328 Welcome: elapsed time: 0.0484869480133 Welcome: elapsed time: 0.00296783447266 Welcome: elapsed time: 0.00293898582458 Welcome: elapsed time: 0.00300216674805 Welcome: elapsed time: 0.00312614440918 The Welcome discrepancy is just under 2x, not nearly as bad as 10x in my shipping code. On Sunday, 16 March 2014 17:52:00 UTC-4, Massimo Di Pierro wrote: In order to isolate the problem one must take it in steps. This is a good test but you must first perform this test with the code you proposed before: def test(): t = time.time start = t() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(t()-start)) return I would like to know the results about this test code first. The other code you are using performs an import: from shippackage import Package Now that is something that is very different in web2py and flask for example. In web2py the import is executed at every request (although it should be cached by Python) while in flask it is executed only once. This should also not cause a performance difference but it is a different test than the one above. TLTR: we should test separately python code execution (which may be affected by threading) and import statements (which may be affected by web2py custom_import and/or module weird behavior). On Sunday, 16 March 2014 08:47:13 UTC-5, horridohobbyist wrote: I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second default.py: 0.27 second 0.78 second The Flask program is slightly slower than the command line. However, the Welcome app is about 10x slower! *Web2py is much, much slower than Flask.* I conducted the test in a Parallels VM running Ubuntu Server 12.04 (1GB memory allocated). I have a 2.5GHz dual-core Mac mini with 8GB. I can't quite figure out how to use gunicom. On Saturday, 15 March 2014 23:41:49 UTC-4, horridohobbyist wrote: I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x
Re: [web2py] Re: Python Performance Issue
Anyway, I ran the shipping code Welcome test with both Apache2 and Gunicorn. Here are the results: Apache:Begin... Apache:Elapsed time: 0.28248500824 Apache:Elapsed time: 0.805250167847 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.284092903137 Apache:Elapsed time: 0.797535896301 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.266696929932 Apache:Elapsed time: 0.793596029282 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.271706104279 Apache:Elapsed time: 0.770045042038 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.26541185379 Apache:Elapsed time: 0.798058986664 Apache:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0273849964142 Gunicorn:Elapsed time: 0.0717470645905 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0259709358215 Gunicorn:Elapsed time: 0.0712919235229 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0273978710175 Gunicorn:Elapsed time: 0.0727338790894 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0260291099548 Gunicorn:Elapsed time: 0.0724799633026 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0249080657959 Gunicorn:Elapsed time: 0.0711901187897 Gunicorn:Percentage fill: 60.0 There is no question that the fault lies with Apache. On Monday, 17 March 2014 00:05:58 UTC-4, Massimo Di Pierro wrote: What kind of VM is this? What is the host platform? How many CPU cores? Is VM using all the cores? The only thing I can think of is the GIL and the fact that multithreaded code in python gets slower and slower the more cores I have. On my laptop, with two cores, I do not see any slow down. Rocket preallocate a thread pool. The rationale is that it decreases the latency time. Perhaps you can also try rocket in this way: web2py.py --minthreads=1 --maxthreads=1 This will reduce the number of worker threads to 1. Rocket also runs a background non-worker thread that monitors worker threads and kills them if they get stuck. On Sunday, 16 March 2014 20:22:45 UTC-5, horridohobbyist wrote: Using gunicorn (Thanks, Massimo), I ran the full web2py Welcome code: Welcome: elapsed time: 0.0511929988861 Welcome: elapsed time: 0.0024790763855 Welcome: elapsed time: 0.00262713432312 Welcome: elapsed time: 0.00224614143372 Welcome: elapsed time: 0.00218415260315 Welcome: elapsed time: 0.00213503837585 Oddly enough, it's slightly faster! But still 37% slower than the command line execution. I'd really, really, **really** like to know why the shipping code is 10x slower... On Sunday, 16 March 2014 21:13:56 UTC-4, horridohobbyist wrote: Okay, I did the calculations test in my Linux VM using command line (fred0), Flask (hello0), and web2py (Welcome). fred0: elapsed time: 0.00159001350403 fred0: elapsed time: 0.0015709400177 fred0: elapsed time: 0.00156021118164 fred0: elapsed time: 0.0015971660614 fred0: elapsed time: 0.0031584741 hello0: elapsed time: 0.00271105766296 hello0: elapsed time: 0.00213503837585 hello0: elapsed time: 0.00195693969727 hello0: elapsed time: 0.00224900245667 hello0: elapsed time: 0.00205492973328 Welcome: elapsed time: 0.0484869480133 Welcome: elapsed time: 0.00296783447266 Welcome: elapsed time: 0.00293898582458 Welcome: elapsed time: 0.00300216674805 Welcome: elapsed time: 0.00312614440918 The Welcome discrepancy is just under 2x, not nearly as bad as 10x in my shipping code. On Sunday, 16 March 2014 17:52:00 UTC-4, Massimo Di Pierro wrote: In order to isolate the problem one must take it in steps. This is a good test but you must first perform this test with the code you proposed before: def test(): t = time.time start = t() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(t()-start)) return I would like to know the results about this test code first. The other code you are using performs an import: from shippackage import Package Now that is something that is very different in web2py and flask for example. In web2py the import is executed at every request (although it should be cached by Python) while in flask it is executed only once. This should also not cause a performance difference but it is a different test than the one above. TLTR: we should test separately python code execution (which may be affected by threading) and import statements (which may be affected by web2py custom_import and/or module weird behavior). On Sunday, 16 March 2014 08:47:13 UTC-5, horridohobbyist wrote: I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second
Re: [web2py] Re: Python Performance Issue
I bumped up the number of processors from 1 to 4. Here are the results: Apache:Begin... Apache:Elapsed time: 2.31899785995 Apache:Elapsed time: 6.31404495239 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.274327039719 Apache:Elapsed time: 0.832695960999 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.277992010117 Apache:Elapsed time: 0.875190019608 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.284713983536 Apache:Elapsed time: 0.82108092308 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.289800882339 Apache:Elapsed time: 0.850221157074 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.287453889847 Apache:Elapsed time: 0.822550058365 Apache:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 1.9300968647 Gunicorn:Elapsed time: 5.28614592552 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.315547943115 Gunicorn:Elapsed time: 0.944733142853 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.321009159088 Gunicorn:Elapsed time: 0.95100903511 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.310179948807 Gunicorn:Elapsed time: 0.930527925491 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.311529874802 Gunicorn:Elapsed time: 0.939922809601 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.308799028397 Gunicorn:Elapsed time: 0.932448863983 Gunicorn:Percentage fill: 60.0 WTF. Now, both Apache and Gunicorn are slow. *Equally slow!* I am befuddled. I think I'll go get stinking drunk... On Monday, 17 March 2014 11:58:07 UTC-4, Cliff Kachinske wrote: Apparently the number of cores is adjustable. Try this link. http://download.parallels.com/desktop/v5/docs/en/Parallels_Desktop_Users_Guide/23076.htm On Monday, March 17, 2014 10:02:13 AM UTC-4, horridohobbyist wrote: Parallels VM running on a 2.5GHz dual-core Mac mini. I really don't know what Parallels uses. On Monday, 17 March 2014 00:05:58 UTC-4, Massimo Di Pierro wrote: What kind of VM is this? What is the host platform? How many CPU cores? Is VM using all the cores? The only thing I can think of is the GIL and the fact that multithreaded code in python gets slower and slower the more cores I have. On my laptop, with two cores, I do not see any slow down. Rocket preallocate a thread pool. The rationale is that it decreases the latency time. Perhaps you can also try rocket in this way: web2py.py --minthreads=1 --maxthreads=1 This will reduce the number of worker threads to 1. Rocket also runs a background non-worker thread that monitors worker threads and kills them if they get stuck. On Sunday, 16 March 2014 20:22:45 UTC-5, horridohobbyist wrote: Using gunicorn (Thanks, Massimo), I ran the full web2py Welcome code: Welcome: elapsed time: 0.0511929988861 Welcome: elapsed time: 0.0024790763855 Welcome: elapsed time: 0.00262713432312 Welcome: elapsed time: 0.00224614143372 Welcome: elapsed time: 0.00218415260315 Welcome: elapsed time: 0.00213503837585 Oddly enough, it's slightly faster! But still 37% slower than the command line execution. I'd really, really, **really** like to know why the shipping code is 10x slower... On Sunday, 16 March 2014 21:13:56 UTC-4, horridohobbyist wrote: Okay, I did the calculations test in my Linux VM using command line (fred0), Flask (hello0), and web2py (Welcome). fred0: elapsed time: 0.00159001350403 fred0: elapsed time: 0.0015709400177 fred0: elapsed time: 0.00156021118164 fred0: elapsed time: 0.0015971660614 fred0: elapsed time: 0.0031584741 hello0: elapsed time: 0.00271105766296 hello0: elapsed time: 0.00213503837585 hello0: elapsed time: 0.00195693969727 hello0: elapsed time: 0.00224900245667 hello0: elapsed time: 0.00205492973328 Welcome: elapsed time: 0.0484869480133 Welcome: elapsed time: 0.00296783447266 Welcome: elapsed time: 0.00293898582458 Welcome: elapsed time: 0.00300216674805 Welcome: elapsed time: 0.00312614440918 The Welcome discrepancy is just under 2x, not nearly as bad as 10x in my shipping code. On Sunday, 16 March 2014 17:52:00 UTC-4, Massimo Di Pierro wrote: In order to isolate the problem one must take it in steps. This is a good test but you must first perform this test with the code you proposed before: def test(): t = time.time start = t() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(t()-start)) return I would like to know the results about this test code first. The other code you are using performs an import: from shippackage import Package Now that is something that is very different in web2py and flask for example. In web2py the import is executed at every request (although it should be cached by Python) while in flask it is executed only once. This should
Re: [web2py] Re: Python Performance Issue
I don't know if bumping up the number of processors from 1 to 4 makes sense. I have a dual-core Mac mini. The VM may be doing something funny. I changed to 2 processors and we're back to the 10x performance discrepancy. So whether it's 1 or 2 processors makes very little difference. Apache:Elapsed time: 2.27643203735 Apache:Elapsed time: 6.1853530407 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.270731925964 Apache:Elapsed time: 0.80504989624 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.292776823044 Apache:Elapsed time: 0.856013059616 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.28355884552 Apache:Elapsed time: 0.832424879074 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.310907125473 Apache:Elapsed time: 0.810643911362 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.282160043716 Apache:Elapsed time: 0.809345960617 Apache:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0269491672516 Gunicorn:Elapsed time: 0.0727801322937 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0269680023193 Gunicorn:Elapsed time: 0.0745708942413 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0281398296356 Gunicorn:Elapsed time: 0.0747048854828 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0501861572266 Gunicorn:Elapsed time: 0.0854380130768 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.0284719467163 Gunicorn:Elapsed time: 0.0778048038483 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.026153087616 Gunicorn:Elapsed time: 0.0714471340179 Gunicorn:Percentage fill: 60.0 On Monday, 17 March 2014 12:21:33 UTC-4, horridohobbyist wrote: I bumped up the number of processors from 1 to 4. Here are the results: Apache:Begin... Apache:Elapsed time: 2.31899785995 Apache:Elapsed time: 6.31404495239 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.274327039719 Apache:Elapsed time: 0.832695960999 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.277992010117 Apache:Elapsed time: 0.875190019608 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.284713983536 Apache:Elapsed time: 0.82108092308 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.289800882339 Apache:Elapsed time: 0.850221157074 Apache:Percentage fill: 60.0 Apache:Begin... Apache:Elapsed time: 0.287453889847 Apache:Elapsed time: 0.822550058365 Apache:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 1.9300968647 Gunicorn:Elapsed time: 5.28614592552 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.315547943115 Gunicorn:Elapsed time: 0.944733142853 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.321009159088 Gunicorn:Elapsed time: 0.95100903511 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.310179948807 Gunicorn:Elapsed time: 0.930527925491 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.311529874802 Gunicorn:Elapsed time: 0.939922809601 Gunicorn:Percentage fill: 60.0 Gunicorn:Begin... Gunicorn:Elapsed time: 0.308799028397 Gunicorn:Elapsed time: 0.932448863983 Gunicorn:Percentage fill: 60.0 WTF. Now, both Apache and Gunicorn are slow. *Equally slow!* I am befuddled. I think I'll go get stinking drunk... On Monday, 17 March 2014 11:58:07 UTC-4, Cliff Kachinske wrote: Apparently the number of cores is adjustable. Try this link. http://download.parallels.com/desktop/v5/docs/en/Parallels_Desktop_Users_Guide/23076.htm On Monday, March 17, 2014 10:02:13 AM UTC-4, horridohobbyist wrote: Parallels VM running on a 2.5GHz dual-core Mac mini. I really don't know what Parallels uses. On Monday, 17 March 2014 00:05:58 UTC-4, Massimo Di Pierro wrote: What kind of VM is this? What is the host platform? How many CPU cores? Is VM using all the cores? The only thing I can think of is the GIL and the fact that multithreaded code in python gets slower and slower the more cores I have. On my laptop, with two cores, I do not see any slow down. Rocket preallocate a thread pool. The rationale is that it decreases the latency time. Perhaps you can also try rocket in this way: web2py.py --minthreads=1 --maxthreads=1 This will reduce the number of worker threads to 1. Rocket also runs a background non-worker thread that monitors worker threads and kills them if they get stuck. On Sunday, 16 March 2014 20:22:45 UTC-5, horridohobbyist wrote: Using gunicorn (Thanks, Massimo), I ran the full web2py Welcome code: Welcome: elapsed time: 0.0511929988861 Welcome: elapsed time: 0.0024790763855 Welcome: elapsed time: 0.00262713432312 Welcome: elapsed time: 0.00224614143372 Welcome: elapsed time: 0.00218415260315 Welcome: elapsed time: 0.00213503837585 Oddly enough, it's
Re: [web2py] Re: Python Performance Issue
How or where do I locate the mod_wsgi settings? (I am the furthest thing from being an Apache expert as you can find.) Thanks. On Monday, 17 March 2014 20:20:00 UTC-4, Tim Richardson wrote: There is no question that the fault lies with Apache. Perhaps it is fairer to say the fault lies with mod_wsgi ? What are the mod_wsgi settings in your apache config? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
I don't know if this is relevant, but in apache2.conf, there is a MaxClients parameter for the prefork MPM and it's set to 150. This is the default. I changed it to 15, but it made no difference in the test. On Monday, 17 March 2014 21:15:12 UTC-4, Tim Richardson wrote: (I am the furthest thing from being an Apache expert as you can find.) Well, whereever that puts you, I'll be in shouting distance. I guess this means you are using defaults. The defaults are sensible for small loads, so I don't think you would get better performance from tweaking. These default settings should set you up with 15 threads running under one process which for a small load should be optimal that is, it's as good as it's going to get. You get these sensible defaults if you used the deployment script mentioned in the web2py book (the settings are in the /etc/apache2/sites-available/default file) threads are faster than processes, but gunicorn and nginx don't even use threads. They manage their workloads inside a single thread which makes them fast as long as nothing CPU intensive is happening. \ Thanks. On Monday, 17 March 2014 20:20:00 UTC-4, Tim Richardson wrote: There is no question that the fault lies with Apache. Perhaps it is fairer to say the fault lies with mod_wsgi ? What are the mod_wsgi settings in your apache config? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
I'm disturbed by the fact that the defaults are sensible. That suggests there is no way to improve the performance. A 2x-10x performance hit is very serious. I was considering dropping Apache and going with nginx/gunicorn in my Linux server, but I'm not sure that's a good idea. Apache is a nearly universal web server and one cannot simply ignore it. Also, I'm not sure I can duplicate the functionality in my current Apache setup in nginx/gunicorn. On Monday, 17 March 2014 21:15:12 UTC-4, Tim Richardson wrote: (I am the furthest thing from being an Apache expert as you can find.) Well, whereever that puts you, I'll be in shouting distance. I guess this means you are using defaults. The defaults are sensible for small loads, so I don't think you would get better performance from tweaking. These default settings should set you up with 15 threads running under one process which for a small load should be optimal that is, it's as good as it's going to get. You get these sensible defaults if you used the deployment script mentioned in the web2py book (the settings are in the /etc/apache2/sites-available/default file) threads are faster than processes, but gunicorn and nginx don't even use threads. They manage their workloads inside a single thread which makes them fast as long as nothing CPU intensive is happening. \ Thanks. On Monday, 17 March 2014 20:20:00 UTC-4, Tim Richardson wrote: There is no question that the fault lies with Apache. Perhaps it is fairer to say the fault lies with mod_wsgi ? What are the mod_wsgi settings in your apache config? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second default.py: 0.27 second 0.78 second The Flask program is slightly slower than the command line. However, the Welcome app is about 10x slower! *Web2py is much, much slower than Flask.* I conducted the test in a Parallels VM running Ubuntu Server 12.04 (1GB memory allocated). I have a 2.5GHz dual-core Mac mini with 8GB. I can't quite figure out how to use gunicom. On Saturday, 15 March 2014 23:41:49 UTC-4, horridohobbyist wrote: I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected, you got the exact same clock times as my app (i.e. function directly in the controller). I also stripped out the logging part making the app just return the result and no visible changes to the timings happened. @hh: glad at least we got some grounds to hold on. @mariano: compiled or not, it doesn't seem to change the mean. a compiled app has just lower variance. @all: jlundell definitively hit something. Times are much more lower when threads are 1. BTW: if I change originalscript.py to # -*- coding: utf-8 -*- import time import threading def test(): start = time.time() x = 0.0 for i in range(1,5): x += (float(i+10)*(i+25)+175.0)/3.14 res = str(time.time()-start) print elapsed time: + res + '\n' if __name__ == '__main__': t = threading.Thread(target=test) t.start() t.join() I'm getting really close timings to wsgi environment, 1 thread only tests, i.e. 0.23 min, 0.26 max, ~0.24 mean -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. 430x300x200 430x300x200 400x370x330 390x285x140 585x285x200 430x300x200 400x370x330 553x261x152 290x210x160 390x285x140import time import sys import os debug_path = os.path.join(request.folder,'static/debug.out') def debug(str): f = open(debug_path,'a') f.write(str+'\n') f.close() return # # pyShipping 1.8a # import time import random from shippackage import Package def packstrip(bin, p): Creates a Strip which fits into bin. Returns the Packages to be used in the strip, the dimensions
Re: [web2py] Re: Python Performance Issue
Well, I managed to get *gunicorn* working in a roundabout way. Here are my findings for the fred.py/hello.py test: Elapsed time: 0.028 Elapsed time: 0.068 Basically, it's as fast as the command line test! I'm not sure this tells us much. Is it Apache's fault? Is it web2py's fault? The test is run without the full web2py scaffolding. I don't know how to run web2py on gunicorn, unless someone can tell me. On Sunday, 16 March 2014 16:21:00 UTC-4, Michele Comitini wrote: gunicorn instructions: $ pip install gunicorn $ cd root dir of web2py $ gunicorn -w 4 gluon.main:wsgibase 2014-03-16 14:47 GMT+01:00 horridohobbyist horrido...@gmail.comjavascript:: I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second default.py: 0.27 second 0.78 second The Flask program is slightly slower than the command line. However, the Welcome app is about 10x slower! Web2py is much, much slower than Flask. I conducted the test in a Parallels VM running Ubuntu Server 12.04 (1GB memory allocated). I have a 2.5GHz dual-core Mac mini with 8GB. I can't quite figure out how to use gunicom. On Saturday, 15 March 2014 23:41:49 UTC-4, horridohobbyist wrote: I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected, you got the exact same clock times as my app (i.e. function directly in the controller). I also stripped out the logging part making the app just return the result and no visible changes to the timings happened. @hh: glad at least we got some grounds to hold on. @mariano: compiled or not, it doesn't seem to change the mean. a compiled app has just lower variance. @all: jlundell definitively hit something. Times are much more lower when threads are 1. BTW: if I change originalscript.py to # -*- coding: utf-8 -*- import time import threading def test(): start = time.time() x = 0.0 for i in range(1,5): x += (float(i+10)*(i+25)+175.0)/3.14 res = str(time.time()-start) print elapsed time: + res + '\n' if __name__ == '__main__': t = threading.Thread(target=test) t.start() t.join() I'm getting really close timings to wsgi environment, 1 thread only tests, i.e. 0.23 min, 0.26 max, ~0.24 mean -- Resources: - http://web2py.com - http
Re: [web2py] Re: Python Performance Issue
Failed to find application: 'gluon.main' 2014-03-15 02:23:51 [22339] [INFO] Worker exiting (pid: 22339) ... Traceback (most recent call last): File /usr/local/bin/gunicorn, line 9, in module load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')() ... gunicorn.errors.HaltServer: HaltServer 'App failed to load.' 4 On Sunday, 16 March 2014 16:39:28 UTC-4, Michele Comitini wrote: You basically need to cd into the directory where you have unzipped web2py. Then run gunicorn like the following: gunicorn -w 4 gluon.main:wsgibase There you have web2py reachable on http://localhost:8000 Which part does not work for you? 2014-03-16 21:31 GMT+01:00 horridohobbyist horrido...@gmail.comjavascript:: Well, I managed to get gunicorn working in a roundabout way. Here are my findings for the fred.py/hello.py test: Elapsed time: 0.028 Elapsed time: 0.068 Basically, it's as fast as the command line test! I'm not sure this tells us much. Is it Apache's fault? Is it web2py's fault? The test is run without the full web2py scaffolding. I don't know how to run web2py on gunicorn, unless someone can tell me. On Sunday, 16 March 2014 16:21:00 UTC-4, Michele Comitini wrote: gunicorn instructions: $ pip install gunicorn $ cd root dir of web2py $ gunicorn -w 4 gluon.main:wsgibase 2014-03-16 14:47 GMT+01:00 horridohobbyist horrido...@gmail.com: I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second default.py: 0.27 second 0.78 second The Flask program is slightly slower than the command line. However, the Welcome app is about 10x slower! Web2py is much, much slower than Flask. I conducted the test in a Parallels VM running Ubuntu Server 12.04 (1GB memory allocated). I have a 2.5GHz dual-core Mac mini with 8GB. I can't quite figure out how to use gunicom. On Saturday, 15 March 2014 23:41:49 UTC-4, horridohobbyist wrote: I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected, you got the exact same clock times as my app (i.e. function directly in the controller). I also stripped out the logging part making the app just return the result
Re: [web2py] Re: Python Performance Issue
Okay, I did the calculations test in my Linux VM using command line (fred0), Flask (hello0), and web2py (Welcome). fred0: elapsed time: 0.00159001350403 fred0: elapsed time: 0.0015709400177 fred0: elapsed time: 0.00156021118164 fred0: elapsed time: 0.0015971660614 fred0: elapsed time: 0.0031584741 hello0: elapsed time: 0.00271105766296 hello0: elapsed time: 0.00213503837585 hello0: elapsed time: 0.00195693969727 hello0: elapsed time: 0.00224900245667 hello0: elapsed time: 0.00205492973328 Welcome: elapsed time: 0.0484869480133 Welcome: elapsed time: 0.00296783447266 Welcome: elapsed time: 0.00293898582458 Welcome: elapsed time: 0.00300216674805 Welcome: elapsed time: 0.00312614440918 The Welcome discrepancy is just under 2x, not nearly as bad as 10x in my shipping code. On Sunday, 16 March 2014 17:52:00 UTC-4, Massimo Di Pierro wrote: In order to isolate the problem one must take it in steps. This is a good test but you must first perform this test with the code you proposed before: def test(): t = time.time start = t() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(t()-start)) return I would like to know the results about this test code first. The other code you are using performs an import: from shippackage import Package Now that is something that is very different in web2py and flask for example. In web2py the import is executed at every request (although it should be cached by Python) while in flask it is executed only once. This should also not cause a performance difference but it is a different test than the one above. TLTR: we should test separately python code execution (which may be affected by threading) and import statements (which may be affected by web2py custom_import and/or module weird behavior). On Sunday, 16 March 2014 08:47:13 UTC-5, horridohobbyist wrote: I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second default.py: 0.27 second 0.78 second The Flask program is slightly slower than the command line. However, the Welcome app is about 10x slower! *Web2py is much, much slower than Flask.* I conducted the test in a Parallels VM running Ubuntu Server 12.04 (1GB memory allocated). I have a 2.5GHz dual-core Mac mini with 8GB. I can't quite figure out how to use gunicom. On Saturday, 15 March 2014 23:41:49 UTC-4, horridohobbyist wrote: I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected
Re: [web2py] Re: Python Performance Issue
Using gunicorn (Thanks, Massimo), I ran the full web2py Welcome code: Welcome: elapsed time: 0.0511929988861 Welcome: elapsed time: 0.0024790763855 Welcome: elapsed time: 0.00262713432312 Welcome: elapsed time: 0.00224614143372 Welcome: elapsed time: 0.00218415260315 Welcome: elapsed time: 0.00213503837585 Oddly enough, it's slightly faster! But still 37% slower than the command line execution. I'd really, really, **really** like to know why the shipping code is 10x slower... On Sunday, 16 March 2014 21:13:56 UTC-4, horridohobbyist wrote: Okay, I did the calculations test in my Linux VM using command line (fred0), Flask (hello0), and web2py (Welcome). fred0: elapsed time: 0.00159001350403 fred0: elapsed time: 0.0015709400177 fred0: elapsed time: 0.00156021118164 fred0: elapsed time: 0.0015971660614 fred0: elapsed time: 0.0031584741 hello0: elapsed time: 0.00271105766296 hello0: elapsed time: 0.00213503837585 hello0: elapsed time: 0.00195693969727 hello0: elapsed time: 0.00224900245667 hello0: elapsed time: 0.00205492973328 Welcome: elapsed time: 0.0484869480133 Welcome: elapsed time: 0.00296783447266 Welcome: elapsed time: 0.00293898582458 Welcome: elapsed time: 0.00300216674805 Welcome: elapsed time: 0.00312614440918 The Welcome discrepancy is just under 2x, not nearly as bad as 10x in my shipping code. On Sunday, 16 March 2014 17:52:00 UTC-4, Massimo Di Pierro wrote: In order to isolate the problem one must take it in steps. This is a good test but you must first perform this test with the code you proposed before: def test(): t = time.time start = t() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(t()-start)) return I would like to know the results about this test code first. The other code you are using performs an import: from shippackage import Package Now that is something that is very different in web2py and flask for example. In web2py the import is executed at every request (although it should be cached by Python) while in flask it is executed only once. This should also not cause a performance difference but it is a different test than the one above. TLTR: we should test separately python code execution (which may be affected by threading) and import statements (which may be affected by web2py custom_import and/or module weird behavior). On Sunday, 16 March 2014 08:47:13 UTC-5, horridohobbyist wrote: I've conducted a test with Flask. fred.py is the command line program. hello.py is the Flask program. default.py is the Welcome controller. testdata.txt is the test data. shippackage.py is a required module. fred.py: 0.024 second 0.067 second hello.py: 0.029 second 0.073 second default.py: 0.27 second 0.78 second The Flask program is slightly slower than the command line. However, the Welcome app is about 10x slower! *Web2py is much, much slower than Flask.* I conducted the test in a Parallels VM running Ubuntu Server 12.04 (1GB memory allocated). I have a 2.5GHz dual-core Mac mini with 8GB. I can't quite figure out how to use gunicom. On Saturday, 15 March 2014 23:41:49 UTC-4, horridohobbyist wrote: I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know
[web2py] One Step Production Deployment
I'm trying to reinstall web2py on my Linux server. I'm trying to start from a clean slate... First, I've updated my server to Ubuntu Server 12.04. I've restored the original *httpd.conf* (empty file) and *sites-available/default* files for Apache2. So, for all intents and purposes, web2py is gone from my system. Then, I removed all things web2py from the */home/www-data* folder. So I have a clean slate, right? Finally, I followed the One step production deployment recipe. So, the thing should just work, right? Except, it doesn't. Visit http://67.213.70.250/welcome and you get nothing, /welcome Not Found. Um, what's wrong? This worked just fine in my Linux VM, so I am puzzled. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: One Step Production Deployment
Well, it's not the welcome app. I also can't access the administrative interface: https://67.213.70.250/admin It's almost as if web2py isn't running. How can I verify that the process is running? On Saturday, 15 March 2014 08:09:37 UTC-4, 黄祥 wrote: had you remove the welcome apps? please describe your steps that reproduce the error. ref: http://www.web2pyslices.com/slice/show/1957/install-web2py-on-lubuntu-with-apache-and-mod-wsgi best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: One Step Production Deployment
Okay, I figured out what happened. During the One step production deployment, *for some reason*, the wsgihandler.py file did NOT get copied to the web2py parent folder. Don't ask me why. (In my test VM, the wsgihandler.py file did get copied, in fact, moved. Go figure.) Now, I'm finding that the Administrative Interface cannot locate the CSS for proper rendering. Any ideas? (Why is One step production deployment going so wrong???) On Saturday, 15 March 2014 07:57:59 UTC-4, horridohobbyist wrote: I'm trying to reinstall web2py on my Linux server. I'm trying to start from a clean slate... First, I've updated my server to Ubuntu Server 12.04. I've restored the original *httpd.conf* (empty file) and *sites-available/default* files for Apache2. So, for all intents and purposes, web2py is gone from my system. Then, I removed all things web2py from the */home/www-data* folder. So I have a clean slate, right? Finally, I followed the One step production deployment recipe. So, the thing should just work, right? Except, it doesn't. Visit http://67.213.70.250/welcome and you get nothing, /welcome Not Found. Um, what's wrong? This worked just fine in my Linux VM, so I am puzzled. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: One Step Production Deployment
Okay, I solved the other piece of the mystery. The Administrative Interface view is now referencing its CSS, JS, and plugins in a folder one level deeper called _2.9.4. So I simply created a _2.9.4 folder and moved css, js, plugin_multiselect and plugin_statebutton into it. Everything is now okay. But this begs the question: Why wasn't my test VM doing the same thing with respect to the _2.9.4 folder?? On Saturday, 15 March 2014 12:48:33 UTC-4, horridohobbyist wrote: Okay, I figured out what happened. During the One step production deployment, *for some reason*, the wsgihandler.py file did NOT get copied to the web2py parent folder. Don't ask me why. (In my test VM, the wsgihandler.py file did get copied, in fact, moved. Go figure.) Now, I'm finding that the Administrative Interface cannot locate the CSS for proper rendering. Any ideas? (Why is One step production deployment going so wrong???) On Saturday, 15 March 2014 07:57:59 UTC-4, horridohobbyist wrote: I'm trying to reinstall web2py on my Linux server. I'm trying to start from a clean slate... First, I've updated my server to Ubuntu Server 12.04. I've restored the original *httpd.conf* (empty file) and *sites-available/default* files for Apache2. So, for all intents and purposes, web2py is gone from my system. Then, I removed all things web2py from the */home/www-data* folder. So I have a clean slate, right? Finally, I followed the One step production deployment recipe. So, the thing should just work, right? Except, it doesn't. Visit http://67.213.70.250/welcome and you get nothing, /welcome Not Found. Um, what's wrong? This worked just fine in my Linux VM, so I am puzzled. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: One Step Production Deployment
Sorry, I spoke too soon. While the visual rendering is okay, the menus don't work. So I can't create the _2.9.4 folder. Damn. On Saturday, 15 March 2014 13:08:36 UTC-4, horridohobbyist wrote: Okay, I solved the other piece of the mystery. The Administrative Interface view is now referencing its CSS, JS, and plugins in a folder one level deeper called _2.9.4. So I simply created a _2.9.4 folder and moved css, js, plugin_multiselect and plugin_statebutton into it. Everything is now okay. But this begs the question: Why wasn't my test VM doing the same thing with respect to the _2.9.4 folder?? On Saturday, 15 March 2014 12:48:33 UTC-4, horridohobbyist wrote: Okay, I figured out what happened. During the One step production deployment, *for some reason*, the wsgihandler.py file did NOT get copied to the web2py parent folder. Don't ask me why. (In my test VM, the wsgihandler.py file did get copied, in fact, moved. Go figure.) Now, I'm finding that the Administrative Interface cannot locate the CSS for proper rendering. Any ideas? (Why is One step production deployment going so wrong???) On Saturday, 15 March 2014 07:57:59 UTC-4, horridohobbyist wrote: I'm trying to reinstall web2py on my Linux server. I'm trying to start from a clean slate... First, I've updated my server to Ubuntu Server 12.04. I've restored the original *httpd.conf* (empty file) and *sites-available/default* files for Apache2. So, for all intents and purposes, web2py is gone from my system. Then, I removed all things web2py from the */home/www-data* folder. So I have a clean slate, right? Finally, I followed the One step production deployment recipe. So, the thing should just work, right? Except, it doesn't. Visit http://67.213.70.250/welcome and you get nothing, /welcome Not Found. Um, what's wrong? This worked just fine in my Linux VM, so I am puzzled. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: One Step Production Deployment
Well, I solved the problem by installing manually from source (ie, wget, ./setup-web2py-ubuntu.sh). Strange that this works and the One step production deployment doesn't. Someone really ought to look into this. On Saturday, 15 March 2014 15:15:52 UTC-4, LightDot wrote: As I just wrote in another thread: the _2.9.4 comes from *virtual* static asset management. This number will change now and then, as static files get updated, so please don't go creating actual folders for this. This feature is defined with response.static_version, it's in the book and the troubleshooting in regards to it has been addressed several times in the group. This seems to be one of those features that users have most problems finding information about... Regards On Saturday, March 15, 2014 6:18:50 PM UTC+1, horridohobbyist wrote: Sorry, I spoke too soon. While the visual rendering is okay, the menus don't work. So I can't create the _2.9.4 folder. Damn. On Saturday, 15 March 2014 13:08:36 UTC-4, horridohobbyist wrote: Okay, I solved the other piece of the mystery. The Administrative Interface view is now referencing its CSS, JS, and plugins in a folder one level deeper called _2.9.4. So I simply created a _2.9.4 folder and moved css, js, plugin_multiselect and plugin_statebutton into it. Everything is now okay. But this begs the question: Why wasn't my test VM doing the same thing with respect to the _2.9.4 folder?? On Saturday, 15 March 2014 12:48:33 UTC-4, horridohobbyist wrote: Okay, I figured out what happened. During the One step production deployment, *for some reason*, the wsgihandler.py file did NOT get copied to the web2py parent folder. Don't ask me why. (In my test VM, the wsgihandler.py file did get copied, in fact, moved. Go figure.) Now, I'm finding that the Administrative Interface cannot locate the CSS for proper rendering. Any ideas? (Why is One step production deployment going so wrong???) On Saturday, 15 March 2014 07:57:59 UTC-4, horridohobbyist wrote: I'm trying to reinstall web2py on my Linux server. I'm trying to start from a clean slate... First, I've updated my server to Ubuntu Server 12.04. I've restored the original *httpd.conf* (empty file) and *sites-available/default*files for Apache2. So, for all intents and purposes, web2py is gone from my system. Then, I removed all things web2py from the */home/www-data* folder. So I have a clean slate, right? Finally, I followed the One step production deployment recipe. So, the thing should just work, right? Except, it doesn't. Visit http://67.213.70.250/welcome and you get nothing, /welcome Not Found. Um, what's wrong? This worked just fine in my Linux VM, so I am puzzled. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected, you got the exact same clock times as my app (i.e. function directly in the controller). I also stripped out the logging part making the app just return the result and no visible changes to the timings happened. @hh: glad at least we got some grounds to hold on. @mariano: compiled or not, it doesn't seem to change the mean. a compiled app has just lower variance. @all: jlundell definitively hit something. Times are much more lower when threads are 1. BTW: if I change originalscript.py to # -*- coding: utf-8 -*- import time import threading def test(): start = time.time() x = 0.0 for i in range(1,5): x += (float(i+10)*(i+25)+175.0)/3.14 res = str(time.time()-start) print elapsed time: + res + '\n' if __name__ == '__main__': t = threading.Thread(target=test) t.start() t.join() I'm getting really close timings to wsgi environment, 1 thread only tests, i.e. 0.23 min, 0.26 max, ~0.24 mean -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: One Step Production Deployment
I downloaded the zip file for the source. I unzipped it in my home directory, went into the scripts folder and executed setup-web2py-ubuntu.sh. For some reason, this gave me a working installation, whereas going the wget route did not. On Saturday, 15 March 2014 17:11:42 UTC-4, Anthony wrote: On Saturday, March 15, 2014 4:10:32 PM UTC-4, horridohobbyist wrote: Well, I solved the problem by installing manually from source (ie, wget, ./setup-web2py-ubuntu.sh). Can you explain what you mean by manually from source? Aren't those the exact instructions for the one-step production deployment? Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected, you got the exact same clock times as my app (i.e. function directly in the controller). I also stripped out the logging part making the app just return the result and no visible changes to the timings happened. @hh: glad at least we got some grounds to hold on. @mariano: compiled or not, it doesn't seem to change the mean. a compiled app has just lower variance. @all: jlundell definitively hit something. Times are much more lower when threads are 1. BTW: if I change originalscript.py to # -*- coding: utf-8 -*- import time import threading def test(): start = time.time() x = 0.0 for i in range(1,5): x += (float(i+10)*(i+25)+175.0)/3.14 res = str(time.time()-start) print elapsed time: + res + '\n' if __name__ == '__main__': t = threading.Thread(target=test) t.start() t.join() I'm getting really close timings to wsgi environment, 1 thread only tests, i.e. 0.23 min, 0.26 max, ~0.24 mean -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
I'll see what I can do. It will take time for me to learn how to use another framework. As for trying a different web server, my (production) Linux server is intimately reliant on Apache. I'd have to learn how to use another web server, and then try it in my Linux VM. On Saturday, 15 March 2014 22:45:27 UTC-4, Anthony wrote: Are you able to replicate the exact task in another web framework, such as Flask (with the same server setup)? On Saturday, March 15, 2014 10:34:56 PM UTC-4, horridohobbyist wrote: Well, putting back all my apps hasn't widened the discrepancy. So I don't know why my previous web2py installation was so slow. While the Welcome app with the calculations test shows a 2x discrepancy, the original app that initiated this thread now shows a 13x discrepancy instead of 100x. That's certainly an improvement, but it's still too slow. The size of the discrepancy depends on the code that is executed. Clearly, what I'm doing in the original app (performing permutations) is more demanding than mere arithmetical operations. Hence, 13x vs 2x. I anxiously await any resolution to this performance issue, whether it be in WSGI or in web2py. I'll check in on this thread periodically... On Saturday, 15 March 2014 16:19:12 UTC-4, horridohobbyist wrote: Interestingly, now that I've got a fresh install of web2py with only the Welcome app, my Welcome vs command line test shows a consistent 2x discrepancy, just as you had observed. My next step is to gradually add back all the other apps I had in web2py (I had 8 of them!) and see whether the discrepancy grows with the number of apps. That's the theory I'm working on. Yes, yes, I know, according to the Book, I shouldn't have so many apps installed in web2py. This apparently affects performance. But the truth is, most of those apps are hardly ever executed, so their existence merely represents a static overhead in web2py. In my mind, this shouldn't widen the discrepancy, but you never know. On Saturday, 15 March 2014 11:19:06 UTC-4, Niphlod wrote: @mcm: you got me worried. Your test function was clocking a hell lower than the original script. But then I found out why; one order of magnitude less (5000 vs 5). Once that was corrected, you got the exact same clock times as my app (i.e. function directly in the controller). I also stripped out the logging part making the app just return the result and no visible changes to the timings happened. @hh: glad at least we got some grounds to hold on. @mariano: compiled or not, it doesn't seem to change the mean. a compiled app has just lower variance. @all: jlundell definitively hit something. Times are much more lower when threads are 1. BTW: if I change originalscript.py to # -*- coding: utf-8 -*- import time import threading def test(): start = time.time() x = 0.0 for i in range(1,5): x += (float(i+10)*(i+25)+175.0)/3.14 res = str(time.time()-start) print elapsed time: + res + '\n' if __name__ == '__main__': t = threading.Thread(target=test) t.start() t.join() I'm getting really close timings to wsgi environment, 1 thread only tests, i.e. 0.23 min, 0.26 max, ~0.24 mean -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Python Performance Issue
I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. *That's 35 times faster!* It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. On Friday, 14 March 2014 08:17:00 UTC-4, Leonel Câmara wrote: If you have a performance issue why haven't you used a profiler yet? No one is going to guess it, web2py.py -F foldername Then use something like runsnakerun or pstats. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
Okay, version 2.6.5 is verified. No difference in the Python version. So how to explain the performance difference? On Friday, 14 March 2014 09:36:29 UTC-4, Jonathan Lundell wrote: On 14 Mar 2014, at 6:28 AM, horridohobbyist horrido...@gmail.comjavascript: wrote: I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. *That's 35 times faster!* It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. Easy enough to find out: print sys.version. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
xrange makes no difference. And, yes, I've run the Welcome program dozens of times and the results are very consistent. There is little randomness in time.time(). My Linux server is a dedicated machine at the datacentre. I have it all to myself. Not much else is running on it. Apache2, web2py. On Friday, 14 March 2014 10:53:38 UTC-4, Jonathan Lundell wrote: On 14 Mar 2014, at 7:39 AM, horridohobbyist horrido...@gmail.comjavascript: wrote: Okay, version 2.6.5 is verified. No difference in the Python version. So how to explain the performance difference? It's getting to be interesting. To make the result more robust, I'd try it with a much bigger range, maybe 100x, to be sure that the per-loop time is dominating the report. And just for the heck of it I'd replace range with xrange to see if it makes any difference at all. Something else to keep in mind, especially if you're running this on a shared VM, is that time.time() is giving you clock time, and that can lead to very random results in a shared-hardware environment. Or even in a non-shared one, if there's any other system activity going on. The only way around that is to repeat the experiment a lot (which you're doing, sounds like). On Friday, 14 March 2014 09:36:29 UTC-4, Jonathan Lundell wrote: On 14 Mar 2014, at 6:28 AM, horridohobbyist horrido...@gmail.com wrote: I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. That's 35 times faster! It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. Easy enough to find out: print sys.version. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Python Performance Issue
The computed time interval brackets the calculations. I don't see how that would be affected by HTTP processing. Anyway, just replacing the calculations with a string return gives: elapsed time: 2.09808349609e-05 On Friday, 14 March 2014 11:27:39 UTC-4, Anthony wrote: How long does web2py take to return just a simple string (i.e., remove the calculations from test())? You can't really compare the time an HTTP request takes to the time it takes to run a simple Python script -- a lot more is going in with an HTTP request (though .1 seconds still sounds high). Anthony On Friday, March 14, 2014 9:28:48 AM UTC-4, horridohobbyist wrote: I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. *That's 35 times faster!* It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. On Friday, 14 March 2014 08:17:00 UTC-4, Leonel Câmara wrote: If you have a performance issue why haven't you used a profiler yet? No one is going to guess it, web2py.py -F foldername Then use something like runsnakerun or pstats. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Python Performance Issue
I disagree. I'm getting very consistent results with time.time(). With a print statement, Welcome yields 0.587778091431 second, while the command line execution gives 0.0202300548553 second. Again, that's 29 times faster. On Friday, 14 March 2014 11:51:04 UTC-4, Leonel Câmara wrote: Time is still a bad way to measure as the web2py version process may be getting preempted and not getting as much CPU time. Althoug,h I would agree there seems to be something odd going on here. Possibly dead code elimination. What happens with the time if you add a print x after the for to both versions? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Python Performance Issue
If I take out the calculations and just put x = 0.0, making this essentially an empty loop, I get 0.096 second, which is awfully high for a do-nothing loop. If I remove everything between start = time.time() and debug(), I get 0.1 second. So 0.1 second is the granularity of my measurements. On Friday, 14 March 2014 09:28:48 UTC-4, horridohobbyist wrote: I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. *That's 35 times faster!* It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. On Friday, 14 March 2014 08:17:00 UTC-4, Leonel Câmara wrote: If you have a performance issue why haven't you used a profiler yet? No one is going to guess it, web2py.py -F foldername Then use something like runsnakerun or pstats. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Python Performance Issue
I originally installed web2py according to the Book. This was several years ago. I recently upgraded to the latest version, but I had to do it manually, as the administrative interface had all kinds of permission problems with the upgrade. I have a Dell server box, 2.4GHz quad-core Xeon with 4GB of RAM and 500GB hard drive. It's running Ubuntu Server 10.04. On Friday, 14 March 2014 12:26:44 UTC-4, Massimo Di Pierro wrote: Just adding one datapoint. I am trying this with my mac. In both cases I see 0.002xx seconds. Therefore I cannot reproduce the discrepancy. Are you using web2py from source? What kind of machine do you have? Massimo On Friday, 14 March 2014 08:28:48 UTC-5, horridohobbyist wrote: I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. *That's 35 times faster!* It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. On Friday, 14 March 2014 08:17:00 UTC-4, Leonel Câmara wrote: If you have a performance issue why haven't you used a profiler yet? No one is going to guess it, web2py.py -F foldername Then use something like runsnakerun or pstats. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
First, I don't know how to use the profiler. Second, for something as trivially simple as the Welcome app with the calculation loop, what is the profiler going to tell us? That simple multiplication and division are too slow? That the for loop is somehow broken? Should I try to profile the entirety of the web2py framework? Clearly, the Welcome app is pointing to a fundamental issue with my Ubuntu/Apache2/Python/web2py installation (assuming no one else can replicate the problem). As the Linux server is a production system, I am limited to how much tinkering I can actually do on it. BTW, how does one actually shutdown web2py once it's installed and running via Apache? On Friday, 14 March 2014 14:00:35 UTC-4, Michele Comitini wrote: Please try to profile as suggested we need more info. 2014-03-14 18:18 GMT+01:00 horridohobbyist horrido...@gmail.comjavascript:: I originally installed web2py according to the Book. This was several years ago. I recently upgraded to the latest version, but I had to do it manually, as the administrative interface had all kinds of permission problems with the upgrade. I have a Dell server box, 2.4GHz quad-core Xeon with 4GB of RAM and 500GB hard drive. It's running Ubuntu Server 10.04. On Friday, 14 March 2014 12:26:44 UTC-4, Massimo Di Pierro wrote: Just adding one datapoint. I am trying this with my mac. In both cases I see 0.002xx seconds. Therefore I cannot reproduce the discrepancy. Are you using web2py from source? What kind of machine do you have? Massimo On Friday, 14 March 2014 08:28:48 UTC-5, horridohobbyist wrote: I conducted a simple experiment. I took the Welcome app, surely the simplest you can have (no databases, no concurrency, etc.), and added the following to the index page: def test(): start = time.time() x = 0.0 for i in range(1,5000): x += (float(i+10)*(i+25)+175.0)/3.14 debug(elapsed time: +str(time.time()-start)) return I get an elapsed time of 0.103 seconds. The same exact code in a command line program... if __name__ == '__main__': test() gives an elapsed time of 0.003 seconds. That's 35 times faster! It's not the 2 orders of magnitude I'm seeing in the pyShipping code, but my point is proven. There is something hinky about web2py that makes Python code execute much more slowly. Is web2py using a different Python version? As far as I can tell, I only have Python 2.6.5 installed on my Linux server. On Friday, 14 March 2014 08:17:00 UTC-4, Leonel Câmara wrote: If you have a performance issue why haven't you used a profiler yet? No one is going to guess it, web2py.py -F foldername Then use something like runsnakerun or pstats. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
Okay, I have some excellent news to report. Well, excellent for me, not so much for you guys... I can reproduce the problem on another system. Here's what I did: My Mac has Parallels installed. I created a new VM, downloaded Ubuntu Server 12.04, and installed it. Then I updated it with the latest patches. Then, following the recipe from the Book for One step production deployment, I installed web2py 2.9.4. I then ran the same Welcome vs command line test. The result? Welcome: elapsed time: 0.0491468906403 command line: elapsed time: 0.00160121917725 Again, the command line is 30.6 times faster!!! What more evidence do you need? Sorry to say, but there is something wrong with web2py. On Friday, 14 March 2014 14:44:58 UTC-4, Jonathan Lundell wrote: On 14 Mar 2014, at 11:28 AM, horridohobbyist horrido...@gmail.comjavascript: wrote: First, I don't know how to use the profiler. Second, for something as trivially simple as the Welcome app with the calculation loop, what is the profiler going to tell us? That simple multiplication and division are too slow? That the for loop is somehow broken? Should I try to profile the entirety of the web2py framework? I doubt that the profile would tell you much about the loop itself, but it might show work going on elsewhere, which might be instructive. Clearly, the Welcome app is pointing to a fundamental issue with my Ubuntu/Apache2/Python/web2py installation (assuming no one else can replicate the problem). As the Linux server is a production system, I am limited to how much tinkering I can actually do on it. BTW, how does one actually shutdown web2py once it's installed and running via Apache? It's running as a wsgi process under Apache, so you really need to shut down Apache, or at least reconfigure it to not run web2py and then do a graceful restart. For this kind of testing (not production), it might be easier to run web2py directly and use Rocket. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
I don't understand logging. How do I examine the log? Where is it?? On Friday, 14 March 2014 18:29:15 UTC-4, Michele Comitini wrote: Can you try with the following? note: no DAL, no sessions 2014-03-14 22:23 GMT+01:00 Niphlod nip...@gmail.com javascript:: On Friday, March 14, 2014 10:17:40 PM UTC+1, Jonathan Lundell wrote: On 14 Mar 2014, at 2:16 PM, Jonathan Lundell jlun...@pobox.com wrote: Setting aside that your 2x is a lot better than HH's, what's been bothering me (assuming the effect is real) is: what could possibly be the mechanism? I'm always luckier than users. What can I say ? I love my computer ^__^ Running it with web2py -S eliminates some possibilities, too, relating to the restricted environment stuff. That's what I thought So I'm thinking it must be thread activity. Yappi comes to mind, but not sure how to invoke it in a wsgi environment. How about Rocket with min max threads set to 1? ykes! 0.23 min, 0.27 max, ~0.25 mean -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Python Performance Issue
Astonishingly, I've discovered something else... When I ran the test in my newly-created VM, I only ran it once. Later, I noticed I wasn't getting the 30x ratio anymore; I was only getting 2x, like Niphlod did. Luckily, I had taken a snapshot of the VM before running the test, so I reverted back to it. This time, I ran the test repeatedly. Here are the results: elapsed time: 0.0515658855438 elapsed time: 0.00306177139282 elapsed time: 0.00300478935242 elapsed time: 0.00301694869995 elapsed time: 0.00319504737854 Note that it is only *the first run* that shows the 30x ratio. Thereafter, I'm only getting the 2x ratio. *This pattern is repeatable*. I wish I could get 2x ratio on my production server; I could live with that. However, I'm still getting 30x. For some reason, it's not settling down to 2x like in my VM. Go figure. On Friday, 14 March 2014 15:21:12 UTC-4, horridohobbyist wrote: Okay, I have some excellent news to report. Well, excellent for me, not so much for you guys... I can reproduce the problem on another system. Here's what I did: My Mac has Parallels installed. I created a new VM, downloaded Ubuntu Server 12.04, and installed it. Then I updated it with the latest patches. Then, following the recipe from the Book for One step production deployment, I installed web2py 2.9.4. I then ran the same Welcome vs command line test. The result? Welcome: elapsed time: 0.0491468906403 command line: elapsed time: 0.00160121917725 Again, the command line is 30.6 times faster!!! What more evidence do you need? Sorry to say, but there is something wrong with web2py. On Friday, 14 March 2014 14:44:58 UTC-4, Jonathan Lundell wrote: On 14 Mar 2014, at 11:28 AM, horridohobbyist horrido...@gmail.com wrote: First, I don't know how to use the profiler. Second, for something as trivially simple as the Welcome app with the calculation loop, what is the profiler going to tell us? That simple multiplication and division are too slow? That the for loop is somehow broken? Should I try to profile the entirety of the web2py framework? I doubt that the profile would tell you much about the loop itself, but it might show work going on elsewhere, which might be instructive. Clearly, the Welcome app is pointing to a fundamental issue with my Ubuntu/Apache2/Python/web2py installation (assuming no one else can replicate the problem). As the Linux server is a production system, I am limited to how much tinkering I can actually do on it. BTW, how does one actually shutdown web2py once it's installed and running via Apache? It's running as a wsgi process under Apache, so you really need to shut down Apache, or at least reconfigure it to not run web2py and then do a graceful restart. For this kind of testing (not production), it might be easier to run web2py directly and use Rocket. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Python Performance Issue
I have a rather peculiar Python performance issue with web2py. I'm using pyShipping 1.8a (from http://pydoc.net/Python/pyShipping/1.8a/). The standalone program from the command line works quickly. However, after I've incorporated the code into my web2py application, the same pyShipping code takes orders of magnitude longer to execute!!! How can this be?! I presume in both instances that pre-compiled code is being run. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Python Performance Issue
Yes, same machine, same installation. All I did was move the module from my test directory to web2py's site-packages folder. Then I copied the main program into my default application controller. *The same code is executing* . Just to be sure I'm not going out of mind, I printed out the elapsed time for each iteration in the main program (for both the command line execution and the web2py app execution). Lo and behold, the elapsed time for each iteration is much longer under web2py. Note that pyShipping is a pure Python implementation. The Python supporting libraries **should** be the same in both instances. I do note, however, that when I tried to incorporate the code into web2py, I found a namespace clash (class Package appears elsewhere in the web2py installation). I resolved this by renaming the module file. Otherwise, there should be no difference between command line execution and web2py execution. Thanks. On Thursday, 13 March 2014 15:54:37 UTC-4, Jonathan Lundell wrote: On 13 Mar 2014, at 12:48 PM, horridohobbyist horrido...@gmail.comjavascript: wrote: I have a rather peculiar Python performance issue with web2py. I'm using pyShipping 1.8a (from http://pydoc.net/Python/pyShipping/1.8a/). The standalone program from the command line works quickly. However, after I've incorporated the code into my web2py application, the same pyShipping code takes orders of magnitude longer to execute!!! How can this be?! I presume in both instances that pre-compiled code is being run. Same machine, same Python installation? If not, maybe C vs Python supporting libraries? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Add Custom Function to Administrative Interface
Is there a way to add a custom function to the Administrative Interface? Something to do a more sophisticated report on databases? I could even live with running such a function from the shell, though a webpage would be nice. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to post a request to a web api
I'm trying to use a RESTful API by issuing a post. I found this tidbit on the Internet: http://www.web2pyslices.com/slice/show/1533/restful-api-with-web2py But it seems to be outdated, as I cannot import 'requests'. What's the procedure for working with a web API? (I suppose I could use jQuery, but I don't understand how to get the results of a post back to the controller. It's too messy.) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
Yes, REST is definitely simpler. I'm not too familiar with JavaScript. Let me explain what I'm trying to do... I have two SQLFORM.grids on the same page. The user clicks on one row of one grid to add that row to the other grid. A simple enough application pattern. Just like when you click on delete to delete a row from a grid and the grid automatically updates on the page, I want something similar to occur here. Now, this works fine as far as it goes using links and REST. However, if the first grid has pagination and you're on, say, the third page, I'd like to preserve my place (ie, stay on page 3) when the page is updated. It's not a big deal, I guess. The user will have to manually go back to where he was before. On Sunday, 2 March 2014 01:41:31 UTC-5, Tim Richardson wrote: I'm probably not following you, but if you want the server to do something resulting in new content on the page, you either instigate a new request via a URL (which I think is known as the REST method), or use AJAX to fetch data from the server (and then use javascript to update part of the page). the links method that you have above is a REST approach. It has to create a request and a page reload, that's the way it works. Using AJAX is easy with web2py, see the chapter on AJAX and perhaps the following chapter on components. In this case the action on your link can not be a URL since this makes a request page load. You would execute javascript instead. REST is simpler I think. AJAX is a smoother user experience (there is no page reload, for example). On Sunday, 2 March 2014 03:34:41 UTC+11, horridohobbyist wrote: Okay, then, I see another issue... Right now, I'm trying to execute the function by using a link: links=[lambda row: A('Add',_href=URL('add',args=[db.videos,row.id ,user_id]))], But this means a new request in the Add function. I really should execute a function *in-place* on the current webpage. How do I do that? Thanks. On Saturday, 1 March 2014 08:30:33 UTC-5, Anthony wrote: Notice in Tim's example, vars is an argument of URL(). On Saturday, March 1, 2014 7:40:36 AM UTC-5, horridohobbyist wrote: type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
Okay, then, I see another issue... Right now, I'm trying to execute the function by using a link: links=[lambda row: A('Add',_href=URL('add',args=[db.videos,row.id,user_id]))], But this means a new request in the Add function. I really should execute a function *in-place* on the current webpage. How do I do that? Thanks. On Saturday, 1 March 2014 08:30:33 UTC-5, Anthony wrote: Notice in Tim's example, vars is an argument of URL(). On Saturday, March 1, 2014 7:40:36 AM UTC-5, horridohobbyist wrote: type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] SQLFORM.grid to update page
I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] SQLFORM.grid pagination and messed up URL
I have a SQLFORM.grid with pagination. It's in a webpage with the following URL: https://mydomain.com/myapp/admin/view_client/auth_user/3 When you go to the next page of the grid, the URL becomes: https://mydomain.com/myapp/admin/view_client?page=2 However, this is patently wrong! The URL should preserve the two arguments (auth_user/3). By removing those two arguments, my app croaks. Is there a sensible workaround? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Using Recaptcha
Whoa! That works. So the gluon.tools documentation was erroneous. Their prototype did not include 'request', at least, not in the preamble at the top. Thanks. On Monday, 24 February 2014 23:14:32 UTC-5, Kiran Subbaraman wrote: Include request in the parameters, and see if that works. Recaptcha(request, ) Kiran Subbaramanhttp://subbaraman.wordpress.com/about/ On Tue, 25-02-2014 6:40 AM, horridohobbyist wrote: I'm trying to use Recaptcha. I'm following the instructions given here: http://www.web2py.com/book/default/chapter/09#CAPTCHA-and-reCAPTCHA However, when I try to execute the form, I get this error: type 'exceptions.AttributeError' 'NoneType' object has no attribute 'env' Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py, line 111, in module File /home/www-data/web2py/gluon/globals.py, line 372, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py, line 41, in index TR(T('Enter what you see:'),Recaptcha(public_key='6LcRI-8SAAwNGmVIDpB_E45iurpVd7Mh5H2g',private_key='6LcRI-8SAHJon4JWF6nAErt_B4kEy-lXBxH5',use_ssl=True,error_message='invalid',label='Verify:',options='')), File /home/www-data/web2py/gluon/tools.py, line 757, in __init__ self.remote_addr = request.env.remote_addr AttributeError: 'NoneType' object has no attribute 'env' I followed the instructions to the letter. I inserted the following in my form: Recaptcha(public_key='my public key',private_key='my private key',use_ssl=True,error_message='invalid',label='Verify:',options='') I don't know what I'm missing. Is the web2py book missing something, too? Methinks it is. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Using Recaptcha
I'm trying to use Recaptcha. I'm following the instructions given here: http://www.web2py.com/book/default/chapter/09#CAPTCHA-and-reCAPTCHA However, when I try to execute the form, I get this error: type 'exceptions.AttributeError' 'NoneType' object has no attribute 'env' Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py, line 111, in module File /home/www-data/web2py/gluon/globals.py, line 372, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py, line 41, in index TR(T('Enter what you see:'),Recaptcha(public_key='6LcRI-8SAAwNGmVIDpB_E45iurpVd7Mh5H2g',private_key='6LcRI-8SAHJon4JWF6nAErt_B4kEy-lXBxH5',use_ssl=True,error_message='invalid',label='Verify:',options='')), File /home/www-data/web2py/gluon/tools.py, line 757, in __init__ self.remote_addr = request.env.remote_addr AttributeError: 'NoneType' object has no attribute 'env' I followed the instructions to the letter. I inserted the following in my form: Recaptcha(public_key='my public key',private_key='my private key',use_ssl=True,error_message='invalid',label='Verify:',options='') I don't know what I'm missing. Is the web2py book missing something, too? Methinks it is. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] include_files() messing with third-party CSS
In web2py_ajax.html, the following line is screwing up the menu in a third-party CSS template: response.include_files() How can I find out what CSS files are being included in this line so that I can try to identify the offending CSS? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to support flash in new layout
Solved. After much trial and error. Wish it was documented somewhere. The steps are fairly straightforward: 1. {{include 'web2py_ajax.html'}} 2. place div class=flash{{=response.flash or ''}}/div somewhere in the body 3. style div.flash { position: fixed; float: right; padding: 10px; top: 10px; right: 30px; opacity: 0.75; margin: 10px 10px 10px 10px; text-align: center; clear: both; color: #fff; font-size: 11pt; text-align: center; vertical-align: middle; cursor: pointer; background: black; border: 2px solid #fff; -moz-border-radius: 5px; -webkit-border-radius: 5px; z-index: 2; } div.error { background-color: red; color: white; padding: 3px; }/style On Friday, 21 February 2014 22:47:17 UTC-5, horridohobbyist wrote: I'm trying to apply a new layout from a third-party CSS template. It generally works. However, I am unable to get any flash messages (eg, response.flash). Trying to merge two sets of CSS files is very tricky. What is the absolute minimum CSS/JS that I need to get flash messages (without dragging in unnecessary CSS that screws up my new layout)? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to support flash in new layout
I'm trying to apply a new layout from a third-party CSS template. It generally works. However, I am unable to get any flash messages (eg, response.flash). Trying to merge two sets of CSS files is very tricky. What is the absolute minimum CSS/JS that I need to get flash messages (without dragging in unnecessary CSS that screws up my new layout)? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid Search
I tried this. It returns empty on grid.element('#w2p_directory_keywords'). Not that it matters. I've decided to keep the Search function as is. On Monday, 17 February 2014 23:18:28 UTC-5, Anthony wrote: Note, if you don't want to create a new search widget but just want to remove the default Javascript widget and instead have a basic search input field, you can do: search_input = grid.element('#w2p_directory_keywords') search_input and search_input.attributes.pop('_onfocus') That simply removes the _onfocus event handler, which disables the Javascript functionality of the widget. Anthony On Monday, February 17, 2014 11:12:52 PM UTC-5, Anthony wrote: Yes. The searchable argument can be a callable that builds a query based on the keywords, and there is a search_widget argument you can use to generate a custom search widget. I suggest you check out the SQLFORM.grid code in gluon.sqlhtml to see how they work. Anthony On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote: I'm using SQLFORM.grid for my application. It's very powerful and saves me a lot of work. However, I would like to alter/customize the search function in the grid. Is there a way for me to do this? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Buttons vs Text Links
Is there a way to render a (standard graphical) button as a text link? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Eliminating Submit Button
I have a SQLFORM.grid that allows the user to select a query from a selection of queries. The user selects the query using this form: FORM(TABLE(TR(T(Choose Category:),SELECT([my_list ],_name='category',value=current)), TR(,INPUT(_type='submit' The grid is: SQLFORM.grid(query, orderby=db.products.category, csv=False) I would like the user to not have to click on a submit button. I just want to have some action that will modify the grid query as soon as the selection is made. What's the best way to do this? (I can think of a very, very messy way, but I'd like to avoid that.) Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] SQLFORM.grid buttons as text
I've applied a layout that I downloaded from web2py.com. The layout turns the Edit and Delete buttons of SQLFORM.grid into textual links (anchors): Edit and Delete. However, the two text labels run together like so: EditDelete. I'd like to put some space between them, ie Edit Delete. I tried doing this in the CSS: .buttontext { padding: 5 px; } And it does give me the spacer. *But* this causes a scroll bar to appear to the right of the grid! What's the right way to do what I'm trying to do? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.