[web2py] References in the book are broken
I'd like to visit the referenced pages from http://www.web2py.com/book/default/chapter/01#Security but I only get the error invalid function (default/reference) Broken: http://www.web2py.com/books/default/reference/29/pythonsecurity http://www.web2py.com/books/default/reference/29/owasp According to the response header it's a 404 NOT FOUND. -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/ !--[if IE 6]scriptfor(x in document.open);/script![endif]--
Re: [web2py] Re: web2py with Plesk Control Panel ?
On 26.1.2012 20:11, Ben Tammetta wrote: Ok, so if I install python 2.6 how do I tell apache, web2py, mod_wsgi and/or mod_python to use the python2.6 version ? If I remember right the only thing you need to do is install a 2.6 version of mod_wsgi. Kenneth
Re: [web2py] getting started with dotcloud
2012/1/26 Brad Miller bonel...@gmail.com: That did it, thanks! Is there a newer version of the tutorial somewhere? Not, as far as I know, but old tutorials are right in most parts. I have some basic questions like how do I get the app to start with an admin password? As far as I know you shouldn't run admin on dotcloud: https://groups.google.com/forum/#!topic/web2py/aoU8FUQiYHs as it's not safe. Just run admin on your machine and deploy the changes later. If you need such feature maybe you should try fluxflex. It allows it using the fluxflex web2py installation. Instructions are here: https://github.com/nus/web2py-for-fluxflex Regards. José L. Thanks, Brad -- Brad Miller On Thursday, January 26, 2012 at 12:13 PM, José Luis Redrejo Rodríguez wrote: 2012/1/26 Brad Miller bonel...@gmail.com: Hi, I'm trying to follow the web2py tutorial that was posted here a while back. Unfortunately that was written using the older version of the command line tools, so some things just don't exist anymore. But I'm going back and forth between the new documentation and the old. I've done the following: dotcloud created myapp I've create the dotcloud.yml file I've symlinked wsgihandler.py to wsgi.py as instructed I've got a requirements.txt file listing my dependencies When I do dotcloud deploy myapp . It uploads, starts the build, then I get: 17:15:44 [www] running build_scripts 17:15:44 [www] creating build/scripts-2.6 17:15:44 [www] error: file '/home/dotcloud/rsync-1327598128997/web2py/ w2p_apps' does not exist 17:15:45 [www] -- Build failed: python ./setup.py install failed with return code 1 17:15:45 --- Aborting due to build failure you must delete the file setup.py included in web2py directory. Dotcloud interprets it as an installer and it's not. José L.
[web2py] Re: Book typo
In views - about auth.navbar(...): It is a heler factory and its output can be manipulated as any other helper. should probably be It is a helper factory and its output can be manipulated as any other helper. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: Book typo
In Views under Mobile development: Notice that the decorator must be important once before using it in a controller. *should probably be:* Notice that the decorator must be imported once before using it in a controller. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: Movuca CMS - Updates and Call for help
Wow!, there's so much to do :). I will try help when I have time. For keepalive features, I'd search for jQuery timing plugins. Anyway, using javascript setInterval and setTimeout functions is not too difficult. There's a web2py LOAD timing feature proposal that might be of use for that purpose: http://code.google.com/p/web2py/issues/detail?id=576 On 27 ene, 05:53, Bruno Rocha rochacbr...@gmail.com wrote: Hi, I just finished the hardest part of the social network, the Notifications Engine, The secret of Facebook success is the notifiers showing news without the need of users to click anywhere. I did a little bit different and it needs improvements but the first draft is working now and this is the basic structure. 1. Movuca now has an API method called _new_event(event_type, **kwargs), this method inserts anything in timeline. 2. Another API method is Notifier.notify(event_type, **kwargs) Both methods uses event_types as a string key and this key is used to configure texts, icons, images and email templates for that kind of event/notification, you can create many event_types you need. In config (a sqlite database) you have notification_options, you can set some keys and worker can be site, queue, scheduler and celery, if worker is site it means that all notifications are sent at the post time (it is very slow if article has too many subscribers) if worker is queue mail is not sent and mail_sent is set to False on that record, the record stores a Pickled state of the notification to be sent later. In your server you need to start the queue worker: $ python web2py.py -S demo -M -N -R applications/appname/private/notification_worker.py This script can run on background and will check for unsent notifications and send it. Scheduller and Cellery are not working yet, I need help with them. For each event_type you can create an html email template that works just like web2py views, but is stored in db. Users can set for each event_type how they want to receive that notification by site by email or both, (users can reply the email to reply the comments or board notifications) In site notifications looks like this:http://www.diigo.com/item/image/121xl/jqgp?size=o(a counter, a popup, a button to mark as read) Now I want to have an ajax keepalive or websockets to pop it automatically (does anyone knows about it?) [image: 1768767_105086613_6030344.png] *TODO*: The TODO list is very large, you can check here:https://github.com/rochacbruno/Movuca/blob/master/TODO I am developing alone and some people are helping with tests, every help is very appreciated, tests, suggestions, code, improvements, coffee, review etc... Thanks feedbacks in movuca.uservoice.com issues in github -- Bruno Rocha [http://rochacbruno.com.br] 1768767_105086613_6030344.png 598 KVerDescargar
[web2py] Re: Empty session after login. How can this happen?
Before the problem I was using port 8010. The day the problem started I used port 8000. But I've changed ports before without problem. There was also a kernel upgrade, but I can't imagine that would cause this. Version 1.99.4 from the start. Checked permissions. Cleared browser cache, cookies and remembered passwords. Changed session repository from file to db with session.connect(request, response, db) Problem still there this AM. No session file when using a file repository, no record in the db when using the db repository. Any more ideas? On Jan 26, 10:11 pm, Bruno Rocha rochacbr...@gmail.com wrote: web2py version was updated? permission to /sessions have changed? try to clean your browser cache, cookies etc and test again On Thu, Jan 26, 2012 at 11:55 PM, Cliff cjk...@gmail.com wrote: My application was working yesterday. I was able to log in and test. Today, Web2py is not writing a session file. Looking in the sessions directory, I have a session file dated the 17th and one dated yesterday. No session file dated today, though I am able to log in to the app. The app gives me a ticket when it tries to execute my models, because I set certain field defaults based on session values. Here is the traceback: Traceback (most recent call last): File /home/cjk/svpy/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/cjk/svpy/applications/sv/models/e.py, line 147, in module (db.property.org_link==session.auth.user.org_link)) AttributeError: 'NoneType' object has no attribute 'user' Anybody got a clue what's going on? -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Nginx + uwsgi file download problem
Hello, I have a file download problem with my Web2py application. The file is about 200kB. web2py version: 1.99.2 (2011-09-26 06:55:33) stable nginx-1.0.6 uwsgi-0.9.9.2 Debian Squeeze. One of my crontroler creates a tar.gz file and returns it to the user. It works well with the default rocket server but not in my production environment. The file is corrupted, actually when a look at the file size it is never the expected size. I have tested the two following return methods: - return open(the_filename,'r+b').read() - return response.stream(open('the_filename','r+b')) with the same results. I have the following Nginx configuration: user nginx; worker_processes 4; events { worker_connections 1024; } http { sendfileon; client_max_body_size 100M; charset utf-8; default_typeapplication/octet-stream; ignore_invalid_headers on; include mime.types; source_charset utf-8; gzip on; gzip_vary on; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ... server { server_name myserver.ens-lyon.fr; listen 443; ssl on; ... keepalive_timeout70; access_log /var/log/myserver_access.log; error_log /var/log/myserver_error.log; location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ { root /var/www/myserver/applications/; expires max; } location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; } location /static { root /var/www/myserver/applications/init/; expires max; } } I have googled the question, tried some Nginx configuration for file download problems without any success. Could you help me? Regards, Thomas
Re: [web2py] cluster: distributed locks
yes... very similar... I guess that just deleting the JS part and creating a new DB object within the plugin (so that it has it own ttransaction) will make the work... thanks On Thu, Jan 26, 2012 at 9:20 AM, Bruno Rocha rochacbr...@gmail.com wrote: I dont know if it is related, but there is a Locking plugin http://web2py.com/plugins/default/locking On Thu, Jan 26, 2012 at 7:05 AM, Sebastian E. Ovide sebastianov...@gmail.com wrote: ok, I guess that the answer is no... (or I didn't formulate the question correctly) On Thu, Jan 19, 2012 at 11:51 PM, sebastian sebastianov...@gmail.comwrote: Hi All, just thinking on how to implement a distributed locking system in web2py using a DB: one row per each lock, lock_name is unique, if the row doesn't exist, then it is locked, if the row exist already, then it cannot be lock as it is already locked ! I'd like to create a module like this (that can be called from anywhere in web2py) def lock(lock name): begin transaction does the row exist ? no = insert new row commit transaction return result def unlock(lock_name): begin transaction delete row where name = lock_name commit transaction BUT not sure if this is possible (of course it is !) in web2py... consider this controller def hello1(): do a lot of things db.commit() do more things in the DB ### here is my doubt: ### if lock(some resource): ### I'm calling a method that opens and close a transaction inside a transaction !!! do something unlock(some resource) else do something else another example 3 if lock(resource A): if lock(resource B): do a lot of things woth both resources unlock(resource B) unlock(resource A) else so other things unlock(resource A) do more things db.commit() do more staff any better idea ? thansk -- Sebastian E. Ovide -- Bruno Rocha [http://rochacbruno.com.br] -- Sebastian E. Ovide
Re: [web2py] Re: begin a transaction manually ?
I guess that defining two will work for me... thanks ! On Thu, Jan 26, 2012 at 2:40 PM, Bruno Rocha rochacbr...@gmail.com wrote: maybe if there's a way to .close() the db to be able to define it again. http://zerp.ly/rochacbruno Em 26/01/2012 12:18, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: You cannot clone it. but can make two. On Jan 26, 3:10 am, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: 2) yes but not concurrently, unless you have two db objects. Is it possible to clone a db object ? instead of declare 2 (or n) db objects in the model, can I create a new one a controller based on db declared in the model ? -- Sebastian E. Ovide -- Sebastian E. Ovide
[web2py] Re: Problem with legacy tables
And yes, as always Massimo :), it is working now, thank You for response :). Taken from trunk: Version 1.99.4 (2012-01-26 12:53:05) stable regards brushek On 26 Sty, 19:54, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Yes. This will be resolved. We are working on it. In fact it may be solved already. Please help us test trunk. On Jan 26, 11:00 am,brushekbrus...@gmail.com wrote: Yes indeed. But the quistion is, if this will be solved some day ? I can stick with old version for a while, but some day I will have to/ need to upgrade. The best of web2py was for me that it is backward compatible. On 26 Sty, 11:51, Alan Etkin spame...@gmail.com wrote: In this issue:http://code.google.com/p/web2py/issues/detail?id=634 I am trying to solve a (supposedly) similar problem, when using SQLFORM with tables wich have custom id field names. Maybe there could be used a common workaround to solve both problems. Anyway, the custom id problem reproduces only in the new non-stable version. On 25 ene, 18:25, Omi Chiba ochib...@gmail.com wrote: Sound like it's related to the issue I posted before.http://code.google.com/p/web2py/issues/detail?id=547 The bottom line is you cannot use SQLFORM.grid/SQLTABLE if you don't have id field.I have also legacy table which doesn't have field called id. I gave using SQLFORM.grid and create the list with table/table. If you're looking for paging, you can use the following plugin which I use. http://dev.s-cubism.com/plugin_paginator On Jan 25, 8:51 am,brushekbrus...@gmail.com wrote: I'm using vim, editing files directly on server. On 25 Sty, 15:47, Marin Pranjić marin.pran...@gmail.com wrote: What do you use for development? If you use an IDE with debugging step-by-step featues, you can find out where does id come from On Wed, Jan 25, 2012 at 3:35 PM,brushekbrus...@gmail.com wrote: On 25 Sty, 15:17, Anthony abasta...@gmail.com wrote: I left the following comment with the issue: shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id ,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False) Note, your refer to db.gk_shop.id, but there is no id field in that table. The name of the id field is actually db.gk_shop.id_modulo (the field _type_ is id, but the field _name_ is id_modulo). In your code, you have to refer to the field name. Anthony OK, I changed the controller: shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_ modulu],user_signature=False,deletable=False) and it isn't the case, the error still remain: Traceback (most recent call last): File /home/users/brushek/web2py-dev/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/users/brushek/web2py-dev/applications/sdadmin/ controllers/default.py, line 138, in module File /home/users/brushek/web2py-dev/gluon/globals.py, line 172, in lambda self._caller = lambda f: f() File /home/users/brushek/web2py-dev/gluon/tools.py, line 2551, in f return action(*a, **b) File /home/users/brushek/web2py-dev/applications/sdadmin/ controllers/default.py, line 16, in shop shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_ modulu],user_signature=False,deletable=False) File /home/users/brushek/web2py-dev/gluon/sqlhtml.py, line 1587, in grid _class='web2py_form', File /home/users/brushek/web2py-dev/gluon/html.py, line 1960, in process self.validate(**kwargs) File /home/users/brushek/web2py-dev/gluon/html.py, line 1907, in validate if self.accepts(**kwargs): File /home/users/brushek/web2py-dev/gluon/sqlhtml.py, line 1042, in accepts formname_id = '.'.join(str(self.record[k]) File /home/users/brushek/web2py-dev/gluon/dal.py, line 5317, in __getattr__ 'firebird': FireBirdAdapter, File /home/users/brushek/web2py-dev/gluon/dal.py, line 5308, in __getitem__ 'postgres': PostgreSQLAdapter, KeyError: 'id'
[web2py] Re: Book typo
In http://www.web2py.com/books/default/chapter/29/4#API (Running tasks in the background): There is not a single was of doing it, should be There is not a single way of doing it, Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
Re: [web2py] Re: Movuca CMS - Updates and Call for help
On Fri, Jan 27, 2012 at 9:04 AM, Alan Etkin spame...@gmail.com wrote: Wow!, there's so much to do :). I will try help when I have time. For keepalive features, I'd search for jQuery timing plugins. Anyway, using javascript setInterval and setTimeout functions is not too difficult. There's a web2py LOAD timing feature proposal that might be of use for that purpose: http://code.google.com/p/web2py/issues/detail?id=576 It is already using setTimeout and is working good for notification counters, but I would like to have a better approach to show live popups for comments, boards and a chat. -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: Standalone DAL Usiage - Insert from a Dictionary (vs bulk_insert)
def populate_table(): for row in sdb().select(sdb.mytbl.ALL): # build a dict for tbl insert for fldname in sdb().mytbl.fields: ddict[fldname] = row[fldname] Note, each row of the select result is a web2py Row object (see http://web2py.com/books/default/chapter/29/6#Query,-Set,-Rows), which inherits from dict -- so you generally don't need to convert it to a dict because it already acts like one. If you do need to convert to a dict (which I don't think is necessary in this case), you can convert using the as_dict() method, and you can convert an entire Rows object to a list of dicts via the as_list() method. See http://web2py.com/books/default/chapter/29/6#as_dict-and-as_list. In terms of simplifying the code, it would probably be easiest to just use bulk_insert (which technically inserts one record at a time via a list comprehension): ddb.mytbl.bulk_insert(sdb().select(sdb.mytbl.ALL).as_list()) Note, I'm not sure the .as_list() is necessary with bulk_insert -- it might accept the Rows object without converting to a list of dicts. Finally, to copy the contents of a table from one db to another, another option is the CSV export and import functionality: http://web2py.com/books/default/chapter/29/6#CSV-(one-Table-at-a-time). Anthony
[web2py] web2py CRUD example
Hi all I'm trying to use the CRUD-feature of web2py (1.99.4). At the moment I'm stuck at invalid view (default/data.html) while accessing https://localhost/init/default/data/tables. So far I've created a simple application init and changed the following: In controllers/default.py I've disabled required_signature (I did not want to play around with permissions at this time): @auth.requires_login() # @auth.requires_signature() def data(): return dict(form=crud()) In views/default.html I've added a link beneath the message: {{=A('table',_href=URL('data/tables',user_signature=True))}} If I follow this link (after authenticating) I just receive the error message: invalid view (default/data.html) I did expect something like a list of tables. Out of the box there seems to be no default/data.html view. Do I have to write my own data.html view to test the CRUD functionality? Or did I do something wrong in the setup? Regards -Gian.
[web2py] Re: Movuca CMS - Updates and Call for help
In site notifications looks like this: http://www.diigo.com/item/image/121xl/jqgp?size=o (a counter, a popup, a button to mark as read) Now I want to have an ajax keepalive or websockets to pop it automatically (does anyone knows about it?) Have you looked at Socket.IO (http://socket.io/). On the server, you'll need a non-blocking web server to handle all the async connections -- for that there's gevent with gevent-socketio (https://bitbucket.org/Jeffrey/gevent-socketio). Some examples from the interwebs: http://bottlepy.org/docs/dev/async.html http://codysoyland.com/2011/feb/6/evented-django-part-one-socketio-and-gevent/ http://toastdriven.com/blog/2011/jul/31/gevent-long-polling-you/ http://sontek.net/pycon-sprints-part-1-the-realtime-web-with-gevent http://blog.abourget.net/2011/3/17/new-and-hot-part-4-pyramid-socket-io-gevent/ There's also Now.js (http://nowjs.com), which is based on Socket.IO, but on the server it's not Python and requires Node.js. Anthony
[web2py] delays with concurrent web requests from different local browsers, using rocket on win7
Hi, I'm using (local environment): rocket / web2py's latest trunk / win7 / postgresql. Since about a month ago I've been experiencing big delays on concurrent web requests from different browsers (different sessions), after applying changeset # 9619eb054669 (Socket timeout is now int an defaults to 60secs). Please read my previous post about this problem: https://groups.google.com/d/msg/web2py/qYEKjMupghs/rTc_UQWzp44J This occurs with rocket locally on my win7 machine. Is there anything I can do to fix these issues?. Thanks, Carlos
Re: [web2py] web2py CRUD example
include response.generic_patterns = ['*'] in your models or in your data controller, so you will be able to use generic views. On Fri, Jan 27, 2012 at 9:01 AM, Gian Luca Decurtins decur...@gmail.comwrote: Hi all I'm trying to use the CRUD-feature of web2py (1.99.4). At the moment I'm stuck at invalid view (default/data.html) while accessing https://localhost/init/default/data/tables. So far I've created a simple application init and changed the following: In controllers/default.py I've disabled required_signature (I did not want to play around with permissions at this time): @auth.requires_login() # @auth.requires_signature() def data(): return dict(form=crud()) In views/default.html I've added a link beneath the message: {{=A('table',_href=URL('data/tables',user_signature=True))}} If I follow this link (after authenticating) I just receive the error message: invalid view (default/data.html) I did expect something like a list of tables. Out of the box there seems to be no default/data.html view. Do I have to write my own data.html view to test the CRUD functionality? Or did I do something wrong in the setup? Regards -Gian. -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Web2py in large web scenarios
Hi, I'm about to start a major project development and although I am a regular user of web2py in my development, they have been mostly in intranets, what worries me is if anyone has had previous experience of putting an application based on web2py with several thousand users, in which case I would like your job with this. Previously, I have dealt with a project based on django super (50 unique users month) and problems of performance, scalability and others were so serious that they chose to pass it to php, I would not do the same with this application in web2py. Thanks Saludos, Alfonso de la Guarda Centro Open Source(COS) http://www.cos-la.net http://alfonsodg.net Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4
Re: [web2py] web2py CRUD example
Thank you! I had to edit models/db.py: # response.generic_patterns = ['*'] if request.is_local else [] response.generic_patterns = ['*'] Regards -Gian. BTW: In the original post I've replaced the FQDN with localhost. If the application did run on localhost this modification should not be necessary.
[web2py] Cherokee deployment config
Hi, I have problems with the configuration of a server cherokee with we2py. I follow the Cherokee with FastCGI manual from: http://www.web2py.com/books/default/chapter/29/13. 1) create the file /var/web2py/startweb2py.sh and set as executable with this content: #!/bin/sh sudo -u www-data python /var/web2py/fcgihandler.fcgi 2) enter in cherokee-admin al port 9090 and config sources with: Nick: web2py Connection: /tmp/fcgi.sock Interpreter: /var/web2py/startweb2py.sh 3) edit vserver default handler with fastcgi and FastCGI Specific set round robin and Assign Information Sources to web2py source before start cherokee server, execute startweb2py.sh and enter to mi ip in the webbrowser al show the startpage from cherokee, i use mi ip/web2py and show error 404. what is wrong? I also try lighttp but the configuration not was successfull. PD: i cant use apache
[web2py] web2py book in Japanese
Congratulations to Omi Chiba, Kenji Hosoda, Kenji Nakagaki, Mitsuhiro Tsuda, and Yota Ichino. The web2py book is now available in PDF in Japanese: http://web2py.com/books/static/web2py_japanese_3rd.pdf
[web2py] Re: References in the book are broken
hmm will work on it asap. On Jan 27, 3:10 am, Stefan Scholl ste...@no-spoon.de wrote: I'd like to visit the referenced pages fromhttp://www.web2py.com/book/default/chapter/01#Securitybut I only get the error invalid function (default/reference) Broken:http://www.web2py.com/books/default/reference/29/pythonsecurityhttp://www.web2py.com/books/default/reference/29/owasp According to the response header it's a 404 NOT FOUND. -- Web (en):http://www.no-spoon.de/-*- Web (de):http://www.frell.de/ !--[if IE 6]scriptfor(x in document.open);/script![endif]--
[web2py] Re: Empty session after login. How can this happen?
Can you login into the welcome app? How about admin? Is this problem specific of one app? On Jan 27, 6:00 am, Cliff cjk...@gmail.com wrote: Before the problem I was using port 8010. The day the problem started I used port 8000. But I've changed ports before without problem. There was also a kernel upgrade, but I can't imagine that would cause this. Version 1.99.4 from the start. Checked permissions. Cleared browser cache, cookies and remembered passwords. Changed session repository from file to db with session.connect(request, response, db) Problem still there this AM. No session file when using a file repository, no record in the db when using the db repository. Any more ideas? On Jan 26, 10:11 pm, Bruno Rocha rochacbr...@gmail.com wrote: web2py version was updated? permission to /sessions have changed? try to clean your browser cache, cookies etc and test again On Thu, Jan 26, 2012 at 11:55 PM, Cliff cjk...@gmail.com wrote: My application was working yesterday. I was able to log in and test. Today, Web2py is not writing a session file. Looking in the sessions directory, I have a session file dated the 17th and one dated yesterday. No session file dated today, though I am able to log in to the app. The app gives me a ticket when it tries to execute my models, because I set certain field defaults based on session values. Here is the traceback: Traceback (most recent call last): File /home/cjk/svpy/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/cjk/svpy/applications/sv/models/e.py, line 147, in module (db.property.org_link==session.auth.user.org_link)) AttributeError: 'NoneType' object has no attribute 'user' Anybody got a clue what's going on? -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: Cherokee deployment config
I found that setting alternative doccument root to /var/web2py/applications the server work, but in the documentation that change does not appear. Solved my self, thanks 2012/1/27 Roberto Perdomo roberto...@gmail.com: Hi, I have problems with the configuration of a server cherokee with we2py. I follow the Cherokee with FastCGI manual from: http://www.web2py.com/books/default/chapter/29/13. 1) create the file /var/web2py/startweb2py.sh and set as executable with this content: #!/bin/sh sudo -u www-data python /var/web2py/fcgihandler.fcgi 2) enter in cherokee-admin al port 9090 and config sources with: Nick: web2py Connection: /tmp/fcgi.sock Interpreter: /var/web2py/startweb2py.sh 3) edit vserver default handler with fastcgi and FastCGI Specific set round robin and Assign Information Sources to web2py source before start cherokee server, execute startweb2py.sh and enter to mi ip in the webbrowser al show the startpage from cherokee, i use mi ip/web2py and show error 404. what is wrong? I also try lighttp but the configuration not was successfull. PD: i cant use apache
Re: [web2py] Web2py in large web scenarios
My first tip is, avoid /models have your code in /modules import what you need only when and where you need! On Fri, Jan 27, 2012 at 1:39 PM, Alfonso de la Guarda alfons...@gmail.comwrote: Hi, I'm about to start a major project development and although I am a regular user of web2py in my development, they have been mostly in intranets, what worries me is if anyone has had previous experience of putting an application based on web2py with several thousand users, in which case I would like your job with this. Previously, I have dealt with a project based on django super (50 unique users month) and problems of performance, scalability and others were so serious that they chose to pass it to php, I would not do the same with this application in web2py. Thanks Saludos, Alfonso de la Guarda Centro Open Source(COS) http://www.cos-la.net http://alfonsodg.net Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4 -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: Movuca CMS - Updates and Call for help
This is a fantastic project! On Jan 27, 2:53 am, Bruno Rocha rochacbr...@gmail.com wrote: Hi, I just finished the hardest part of the social network, the Notifications Engine, The secret of Facebook success is the notifiers showing news without the need of users to click anywhere. I did a little bit different and it needs improvements but the first draft is working now and this is the basic structure. 1. Movuca now has an API method called _new_event(event_type, **kwargs), this method inserts anything in timeline. 2. Another API method is Notifier.notify(event_type, **kwargs) Both methods uses event_types as a string key and this key is used to configure texts, icons, images and email templates for that kind of event/notification, you can create many event_types you need. In config (a sqlite database) you have notification_options, you can set some keys and worker can be site, queue, scheduler and celery, if worker is site it means that all notifications are sent at the post time (it is very slow if article has too many subscribers) if worker is queue mail is not sent and mail_sent is set to False on that record, the record stores a Pickled state of the notification to be sent later. In your server you need to start the queue worker: $ python web2py.py -S demo -M -N -R applications/appname/private/notification_worker.py This script can run on background and will check for unsent notifications and send it. Scheduller and Cellery are not working yet, I need help with them. For each event_type you can create an html email template that works just like web2py views, but is stored in db. Users can set for each event_type how they want to receive that notification by site by email or both, (users can reply the email to reply the comments or board notifications) In site notifications looks like this:http://www.diigo.com/item/image/121xl/jqgp?size=o(a counter, a popup, a button to mark as read) Now I want to have an ajax keepalive or websockets to pop it automatically (does anyone knows about it?) [image: 1768767_105086613_6030344.png] *TODO*: The TODO list is very large, you can check here:https://github.com/rochacbruno/Movuca/blob/master/TODO I am developing alone and some people are helping with tests, every help is very appreciated, tests, suggestions, code, improvements, coffee, review etc... Thanks feedbacks in movuca.uservoice.com issues in github -- Bruno Rocha [http://rochacbruno.com.br] 1768767_105086613_6030344.png 598KViewDownload
[web2py] Re: delays with concurrent web requests from different local browsers, using rocket on win7
What do you get if you reduce 60 seconds to 10 seconds? On Jan 27, 9:27 am, Carlos carlosgali...@gmail.com wrote: Hi, I'm using (local environment): rocket / web2py's latest trunk / win7 / postgresql. Since about a month ago I've been experiencing big delays on concurrent web requests from different browsers (different sessions), after applying changeset # 9619eb054669 (Socket timeout is now int an defaults to 60secs). Please read my previous post about this problem: https://groups.google.com/d/msg/web2py/qYEKjMupghs/rTc_UQWzp44J This occurs with rocket locally on my win7 machine. Is there anything I can do to fix these issues?. Thanks, Carlos
[web2py] how to restart only one app in uwsgi?
HI, May be it is a better question to uwsgi list, but maybe someone here knows.. I have several apps in a single server running uwsgi, every time I need to reload some modules in some app I do /etc/init.d/uwsgi-python restart But it restarts all my apps.. Is there a way to specify which app to restart? Thanks -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] web2py CRUD example
On Friday, January 27, 2012 10:43:53 AM UTC-5, Gian Luca Decurtins wrote: Thank you! I had to edit models/db.py: # response.generic_patterns = ['*'] if request.is_local else [] response.generic_patterns = ['*'] Note, there's a reason that generic views are enabled only on localhost by default -- they can create a security risk by allowing unintended data to leak. For example, generic.json will display everything returned to the view by the controller, including db fields selected but not intended for display and variables only intended to control view display logic. You should be more precise when enabling generic views in production. For example: response.generic_patterns = ['data.html'] or def data(): response.generic_patterns = ['html'] will only enable generic.html (not the other generic views), and only when the data action is called. Anthony
[web2py] Re: delays with concurrent web requests from different local browsers, using rocket on win7
Hi Massimo, Whatever value I assign, it's the number of seconds it usually takes for concurrent requests. With the original default value of 1 (one), the concurrent responses are immediate (as one would expect). Hope this helps, thanks. Carlos
[web2py] Redbean-like ORM in web2py
First off, my appreciation to Massimo and the web2py team for working on such a wonderful product. I had used RedBeanPHP ORM (http://redbeanphp.com/) in a recent project on PHP, and I really liked it. It stays true to it's claim - Combine The Simplicity of NoSQL With The Power of SQL. - making development a breeze after some initial learning curve. I thought the web2py ORM was already one of the best, but I was really blown away by RedBean, how efficient and productive it is - * the way it relieves you from specifying the schema during development * the way it helps you associate different objects without having to worry about foreign keys and complicated JOIN * the way it lets you mix in the power of SQL to fine-tune your query without proprietary/arcane AND/OR constructs There has been a POC implementation in Python: http://pypi.python.org/pypi/pybean which supports SQLite, but looking at it's description, is not meant for primetime yet. So my question is, is there a plan to implement these RedBean-like features in web2py? It can only make development in web2py more productive and efficient.
[web2py] Re: Redbean-like ORM in web2py
I don't know about future development plans, but I can say that web2py does not use an ORM, it uses a database abstraction layer that generates the proper SQL (and NoSQL) code. Lack of an ORM is sometimes touted as a feature of web2py because ORMs are usually big, complicated, and difficult to learn and maintain. Web2py's DAL is about the simplest, yet most powerful database abstraction layer I've ever used, so I'm very happy with the current solution. However, there is nothing stopping you from using RedBrean or even SQLAlchemy in your web2py projects.
Re: [web2py] Web2py in large web scenarios
This is very good advice. I have moved many of my plugins and apps from using models to modules because of the performance gain. There is nothing wrong with the models implementation, but it's really meant to define tables and that's it. Functionality that doesn't belong in a controller should go to modules. Some other advice that I have been gathering for my own deployments is to use Nginx instead of Apache. You will see an incredible increase in the number of requests per second that Nginx can handle over Apache. Also setting up an Nginx front-facing server that is proxying requests to another server running Nginx + web2py might be a good idea for lots of traffic. Have the front-facing server handle the SSL traffic, and maybe even enable caching on the front-end as well. When you need to add another server to handle increased traffic, this front-facing Nginx server can be configured to load balance so that you can scale as much as you need.
[web2py] web2py.com is down ?
Just me ?
Re: [web2py] web2py.com is down ?
On Fri, Jan 27, 2012 at 1:01 PM, Omi Chiba ochib...@gmail.com wrote: Just me ? Me too
Re: [web2py] web2py.com is down ?
+1 Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/1/27 Javier Quarite jquari...@gmail.com On Fri, Jan 27, 2012 at 1:01 PM, Omi Chiba ochib...@gmail.com wrote: Just me ? Me too
Re: [web2py] Web2py in large web scenarios
One other thing I noticed after reading your question a second time: Python (Django and web2py) will run much faster than PHP in almost every case. If you needed to start passing things to PHP in order to speed things up, then you must have been using a highly-tuned PHP configuration and a very untuned Python configuration.
[web2py] Re: Empty session after login. How can this happen?
I think the problem is in the app models, which I have attached below. Apologies for the lengthy post. Note the print statements at the end of db.py. Those statements do not execute until I attempt to use the database administration link on the admin/default/design page. Is that normal? ## db.py, stripped of comments # # -*- coding: utf-8 -*- db = DAL('postgres://redacted) response.generic_patterns = ['*'] if request.is_local else [] from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db, hmac_key=Auth.get_or_create_key()) crud, service, plugins = Crud(db), Service(), PluginManager() crud.settings.update_deletable = False ## This is in place of request_tenant ## It's how I used to handle tenants and I'm comfortable with it ## Old dog, new tricks :) db.define_table('org', Field('name', length=64), Field('created_on', 'datetime', default=request.now), Field('created_by', 'integer'), Field('updated_on', 'datetime', default=request.now), Field('updated_by', 'integer'), Field('is_active', 'boolean', default=True), singular='Organization', plural='Organizations', ) db.org.is_active.readable = db.org.is_active.writable = False db.org.created_on.readable = db.org.created_on.writable = False db.org.created_by.readable = db.org.created_by.writable = False db.org.updated_on.readable = db.org.updated_on.writable = False db.org.updated_by.readable = db.org.updated_by.writable = False db.define_table( 'auth_user', Field('first_name', length=128, default='', label='First name', required=True, comment=SPAN('Required', _style='color:orange;')), Field('middle_name', length=128, default='', label='Middle name'), Field('last_name', length=128, default='', label='Last name'), Field('generation', length=16, default='', label='Generation'), Field('address', length=128, default=''), Field('address_2', length=128, default=''), Field('city', length=32, default=''), Field('state', length=32, default=''), Field('zip', length=12, default=''), Field('email', length=128, default='', unique=True), Field('password', 'password', length=512, writable=False, readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('land_line', length=32, default=''), Field('mobile', length=32, default=''), Field('fax', length=32, default=''), Field('created_on', 'datetime', default=request.now), Field('created_by', 'integer'), Field('updated_on', 'datetime', default=request.now), Field('updated_by', 'integer'), Field('is_active', 'boolean', default=True), Field('org_link', db.org, ), format='%(first_name)s %(middle_name)s %(last_name)s % (generation)s' ) db.auth_user.first_name.requires = \ IS_NOT_EMPTY(error_message='First name is required') db.auth_user.last_name.requires = \ IS_NOT_EMPTY(error_message='Last name is required') db.auth_user.password.requires = [IS_STRONG(), CRYPT()] db.auth_user.email.requires = [IS_EMPTY_OR( [IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db, 'auth_user.email')])] db.auth_user.org_link.requires = IS_IN_DB(db, 'org.id', '%(name)s', zero= Choose) db.auth_user.is_active.readable = db.auth_user.is_active.writable = False db.auth_user.created_on.readable = db.auth_user.created_on.writable = False db.auth_user.created_by.readable = db.auth_user.created_by.writable = False db.auth_user.updated_on.readable = db.auth_user.updated_on.writable = False db.auth_user.updated_by.readable = db.auth_user.updated_by.writable = False db.auth_user.org_link.readable = db.auth_user.org_link.writable = False auth.define_tables() if hasattr(session, 'auth') and hasattr(session.auth, 'user'): db.org.created_by.default = session.auth.user.id else: db.org.created_by.default = 1 mail=auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'y...@gmail.com' mail.settings.login = 'username:password' auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True print 'hello, world' print BEAUTIFY(session) # Application tables file name is e.py # ## ## The
Re: [web2py] web2py.com is down ?
+1 On 1/27/2012 12:04 PM, Ovidio Marinho wrote: +1 Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com mailto:ovidio...@gmail.com ovidiomari...@itjp.net.br mailto:ovidiomari...@itjp.net.br ITJP - itjp.net.br http://itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/1/27 Javier Quarite jquari...@gmail.com mailto:jquari...@gmail.com On Fri, Jan 27, 2012 at 1:01 PM, Omi Chiba ochib...@gmail.com mailto:ochib...@gmail.com wrote: Just me ? Me too
Re: [web2py] Web2py in large web scenarios
I also noted best performance directly rendering the templates and caching views where it can be cached. just replacing return dict() with return response.render(filename, context) in conttrollers and also usins @cached controllers and cached queries. the bottleneck is always server and database, so it is better to use pure Python to sort, find, filter Rows objects than using a lot of database requests. DAL provides .sort .find .exclude and Python has a lot of good things like map, reduce, filter. With one db request you can fetch records put them in cache and use Python in some cases to avoid more sql queries. Even paginations can be done without the need to go to db again. Redis is being a good cache solution. http://zerp.ly/rochacbruno Em 27/01/2012 13:40, Alfonso de la Guarda alfons...@gmail.com escreveu: Hi, I'm about to start a major project development and although I am a regular user of web2py in my development, they have been mostly in intranets, what worries me is if anyone has had previous experience of putting an application based on web2py with several thousand users, in which case I would like your job with this. Previously, I have dealt with a project based on django super (50 unique users month) and problems of performance, scalability and others were so serious that they chose to pass it to php, I would not do the same with this application in web2py. Thanks Saludos, Alfonso de la Guarda Centro Open Source(COS) http://www.cos-la.net http://alfonsodg.net Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4
Re: [web2py] web2py.com is down ?
same here
Re: [web2py] Re: Redbean-like ORM in web2py
However, there is nothing stopping you from using RedBrean or even SQLAlchemy in your web2py projects. RedBean is a php library... :) I used it but I can't say that it is better than web2pys DAL
Re: [web2py] web2py.com is down ?
On Now Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/1/27 Vasile Ermicioi elff...@gmail.com same here
Re: [web2py] Web2py in large web scenarios
This is very good advice. I have moved many of my plugins and apps from using models to modules because of the performance gain. There is nothing wrong with the models implementation, but it's really meant to define tables and that's it. Functionality that doesn't belong in a controller should go to modules. Interesting, so to clarify: are you minimizing the amount of code into the model (limiting it to table definitions) or you avoid using a model at all?
Re: [web2py] Web2py in large web scenarios
It really depends. Querying and returning large datasets can become a huge bottleneck. More than letting db server work on its own relations. If you use a real RDBMS, it's designed to work on it. Web2py doesn't create indexes. You have to make it manually. Making so, RDBMS thanks you a lot and can be your close friend. -- Vinicius Assef. On Fri, Jan 27, 2012 at 4:24 PM, Bruno Rocha rochacbr...@gmail.com wrote: I also noted best performance directly rendering the templates and caching views where it can be cached. just replacing return dict() with return response.render(filename, context) in conttrollers and also usins @cached controllers and cached queries. the bottleneck is always server and database, so it is better to use pure Python to sort, find, filter Rows objects than using a lot of database requests. DAL provides .sort .find .exclude and Python has a lot of good things like map, reduce, filter. With one db request you can fetch records put them in cache and use Python in some cases to avoid more sql queries. Even paginations can be done without the need to go to db again. Redis is being a good cache solution. http://zerp.ly/rochacbruno Em 27/01/2012 13:40, Alfonso de la Guarda alfons...@gmail.com escreveu: Hi, I'm about to start a major project development and although I am a regular user of web2py in my development, they have been mostly in intranets, what worries me is if anyone has had previous experience of putting an application based on web2py with several thousand users, in which case I would like your job with this. Previously, I have dealt with a project based on django super (50 unique users month) and problems of performance, scalability and others were so serious that they chose to pass it to php, I would not do the same with this application in web2py. Thanks Saludos, Alfonso de la Guarda Centro Open Source(COS) http://www.cos-la.net http://alfonsodg.net Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4
Re: [web2py] Cherokee deployment config
I know it is not fcgi but I suggest scgi, it is simpler and couples very well with web2py. In the new web2py cookbook there is a recipe for using cherokee with scgi, there you will find a detailed setup description. The essence is that you create an scgi handler in cherokee. You set cherokee to use scgihandler.py inside the root of web2py as startup process in that same scgihandler. Then you are done. Else use nginx it is excellent see this: http://www.web2pyslices.com/slices/take_slice/143 There you see a simplified setup. In production I suggest to use daemontools to manage the scgihandler process: works like a charm. mic p.s. ;-) good thing you can't use apache+wsgi with cherokee+scgi my system is able to handle 5 times more requests (with session.forget()) ;-) 2012/1/27 Roberto Perdomo roberto...@gmail.com: Hi, I have problems with the configuration of a server cherokee with we2py. I follow the Cherokee with FastCGI manual from: http://www.web2py.com/books/default/chapter/29/13. 1) create the file /var/web2py/startweb2py.sh and set as executable with this content: #!/bin/sh sudo -u www-data python /var/web2py/fcgihandler.fcgi 2) enter in cherokee-admin al port 9090 and config sources with: Nick: web2py Connection: /tmp/fcgi.sock Interpreter: /var/web2py/startweb2py.sh 3) edit vserver default handler with fastcgi and FastCGI Specific set round robin and Assign Information Sources to web2py source before start cherokee server, execute startweb2py.sh and enter to mi ip in the webbrowser al show the startpage from cherokee, i use mi ip/web2py and show error 404. what is wrong? I also try lighttp but the configuration not was successfull. PD: i cant use apache
[web2py] Re: Chunked downloads and corrupt files with Internet Explorer 8 (IE8)
I posted https://github.com/explorigin/Rocket/issues/1#issuecomment-3648126- I suspect it is an interplay between timeouts and sendall(), though I can't really prove it (and I can't reliably reproduce this either right now). Also some characterization about when this happens to me (slow links, dependency on chunk size, etc). TL;DR: I think it is impossible to use sendall/write reliably with Python 2.6's socket wrapper if there's a chance for a timeout (Not sure about earlier versions). Unfortunately, Rocket seems to use sendall/write a lot. I'll be able to test this more next week.
[web2py] Re: web2py.com is down ?
VPS.NET informed me they had a bad switch and needed to replace it. On Jan 27, 1:07 pm, Ovidio Marinho ovidio...@gmail.com wrote: On Now Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/1/27 Vasile Ermicioi elff...@gmail.com same here
[web2py] Re: Chunked downloads and corrupt files with Internet Explorer 8 (IE8)
Thank you. This is really an important issue and should get priority. On Jan 27, 4:04 pm, nick name i.like.privacy@gmail.com wrote: I postedhttps://github.com/explorigin/Rocket/issues/1#issuecomment-3648126-I suspect it is an interplay between timeouts and sendall(), though I can't really prove it (and I can't reliably reproduce this either right now). Also some characterization about when this happens to me (slow links, dependency on chunk size, etc). TL;DR: I think it is impossible to use sendall/write reliably with Python 2.6's socket wrapper if there's a chance for a timeout (Not sure about earlier versions). Unfortunately, Rocket seems to use sendall/write a lot. I'll be able to test this more next week.
Re: [web2py] Web2py in large web scenarios
Are there any good instructions for how to do this?
[web2py] Re: Web2py in large web scenarios
1. It's much easier to scale than it is to gain enough users where scaling is a problem. 2. The framework is almost never the culprit. For example, Disqus has 500 million monthly uniques on Django. 3. There are lots of ways to optimize system performance from caching, to optimizing queries, to refactoring, to upgrading ram/cpu, etc. 4. In most cases, only a tiny percentage of users will be on at the same time so several thousand users should be pretty easy for most frameworks to handle.
[web2py] Re: Redbean-like ORM in web2py
Is the main benefit not having to pre-define models? I suppose that could be nice during development but don't find that to be a big problem with DAL. DAL is pretty integral to Web2py and one of the most popular features. And it has many of the same advantages as RedBean and from my brief look, appears much easier to understand. It's hard to see how something like RedBean would be incorporated. I suppose there's nothing stopping one from trying to create some sort of module or add-on.
[web2py] Re: Nginx + uwsgi file download problem
Hard to say. I don't know if this helps but here's how appadmin does it for a csv file: def csv(): import gluon.contenttype response.headers['Content-Type'] = \ gluon.contenttype.contenttype('.csv') db = get_database(request) query = get_query(request) if not query: return None response.headers['Content-disposition'] = 'attachment; filename=%s_%s.csv'\ % tuple(request.vars.query.split('.')[:2]) return str(db(query).select())
Re: [web2py] Web2py in large web scenarios
About db bottlenecks: I think that using executesql gives a performance gain of 2 orders of magnitude over DAL on datasets with more than 1000 records. The DAL is a huge bottleneck if used inappropriately. I suggest using posgtresql with proper indexing. How? Just take your query and run it inside an EXPLAIN statement, see where indexes are needed and *create those indexes*. Speed improvements are *dramatic*. Pass to the DAL only small datasets: even if python has the best sorting and filtering algorithms around (no kidding), postgresql having those same algorithims is simply faster, because of the way objects are handled in memory. When Massimo says the db is the bottleneck, he does not mean that relational DBs are slow in general, IMHO he means that _your_ DB is slow, badly designed and/or badly queried. I also suggest to pay attention to one more thing. When you write the application and you do some test you do it in a quasi-singlethreaded setup. Well everything works fine. Then you go in production and after you reach 20 hits/sec your db becomes a bottleneck whatever hardware you have. If you are using postgresql use a concurrency model based on procesess, *avoid threads*. i.e. configure web2py to work as uwsgi, scgi or fcgi service. mic 2012/1/27 Vinicius Assef vinicius...@gmail.com: It really depends. Querying and returning large datasets can become a huge bottleneck. More than letting db server work on its own relations. If you use a real RDBMS, it's designed to work on it. Web2py doesn't create indexes. You have to make it manually. Making so, RDBMS thanks you a lot and can be your close friend. -- Vinicius Assef. On Fri, Jan 27, 2012 at 4:24 PM, Bruno Rocha rochacbr...@gmail.com wrote: I also noted best performance directly rendering the templates and caching views where it can be cached. just replacing return dict() with return response.render(filename, context) in conttrollers and also usins @cached controllers and cached queries. the bottleneck is always server and database, so it is better to use pure Python to sort, find, filter Rows objects than using a lot of database requests. DAL provides .sort .find .exclude and Python has a lot of good things like map, reduce, filter. With one db request you can fetch records put them in cache and use Python in some cases to avoid more sql queries. Even paginations can be done without the need to go to db again. Redis is being a good cache solution. http://zerp.ly/rochacbruno Em 27/01/2012 13:40, Alfonso de la Guarda alfons...@gmail.com escreveu: Hi, I'm about to start a major project development and although I am a regular user of web2py in my development, they have been mostly in intranets, what worries me is if anyone has had previous experience of putting an application based on web2py with several thousand users, in which case I would like your job with this. Previously, I have dealt with a project based on django super (50 unique users month) and problems of performance, scalability and others were so serious that they chose to pass it to php, I would not do the same with this application in web2py. Thanks Saludos, Alfonso de la Guarda Centro Open Source(COS) http://www.cos-la.net http://alfonsodg.net Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4
Re: [web2py] Web2py in large web scenarios
I am using /models just to define small global functions and to set some response and request keys. All my code including datamodels I am putting into /modules In my mind I changed the /models to /scripts or /batches so it is more easy to understand why avoiding it. my current structure is: /modules/datamodels/someentity.py - Database definitions /modules/handlers/someentity.py - my code logic and template rendering /modules/helpers/* - miscelanious /modules/myappname.py - My.custom Auth, db, Mail, Service etc.. /controllers/someentytity.py - it will just be a point of entry, here I do selective imports, intantiate the entities and call the template rendering. views files can be stored anywhere filesystem or database. http://zerp.ly/rochacbruno Em 27/01/2012 17:48, Magnitus eric_vallee2...@yahoo.ca escreveu: This is very good advice. I have moved many of my plugins and apps from using models to modules because of the performance gain. There is nothing wrong with the models implementation, but it's really meant to define tables and that's it. Functionality that doesn't belong in a controller should go to modules. Interesting, so to clarify: are you minimizing the amount of code into the model (limiting it to table definitions) or you avoid using a model at all?
Re: [web2py] Web2py in large web scenarios
What confuses me is what modules have access to and what needs to be imported (in modules and controllers).
Re: [web2py] Web2py in large web scenarios
I wonder if DAL should have an ability to return JSON data sets that are then manipulated with JavaScript? Or something like that?
Re: [web2py] Cherokee deployment config
Thank for you suggest. The next monday i try. Today with cherokee and fastcgi the welcome app work fine, but only show the index, and with other apps is the same problem. El 27/01/2012 16:15, Michele Comitini michele.comit...@gmail.com escribió: I know it is not fcgi but I suggest scgi, it is simpler and couples very well with web2py. In the new web2py cookbook there is a recipe for using cherokee with scgi, there you will find a detailed setup description. The essence is that you create an scgi handler in cherokee. You set cherokee to use scgihandler.py inside the root of web2py as startup process in that same scgihandler. Then you are done. Else use nginx it is excellent see this: http://www.web2pyslices.com/slices/take_slice/143 There you see a simplified setup. In production I suggest to use daemontools to manage the scgihandler process: works like a charm. mic p.s. ;-) good thing you can't use apache+wsgi with cherokee+scgi my system is able to handle 5 times more requests (with session.forget()) ;-) 2012/1/27 Roberto Perdomo roberto...@gmail.com: Hi, I have problems with the configuration of a server cherokee with we2py. I follow the Cherokee with FastCGI manual from: http://www.web2py.com/books/default/chapter/29/13. 1) create the file /var/web2py/startweb2py.sh and set as executable with this content: #!/bin/sh sudo -u www-data python /var/web2py/fcgihandler.fcgi 2) enter in cherokee-admin al port 9090 and config sources with: Nick: web2py Connection: /tmp/fcgi.sock Interpreter: /var/web2py/startweb2py.sh 3) edit vserver default handler with fastcgi and FastCGI Specific set round robin and Assign Information Sources to web2py source before start cherokee server, execute startweb2py.sh and enter to mi ip in the webbrowser al show the startpage from cherokee, i use mi ip/web2py and show error 404. what is wrong? I also try lighttp but the configuration not was successfull. PD: i cant use apache
Re: [web2py] Web2py in large web scenarios
Hi, Nice Bruno, But those approachs how many traffic deals? By the way, is the first time that i notice about use the /modules approach to gain performance, are you measure the performance por models inside /model and /modules? To all: Mores experiences? Problem resolutions? Maybe put all of this inside a document will be great for help to many users when scalability is their minds. Saludos, Alfonso de la Guarda Centro Open Source(COS) http://www.cos-la.net http://alfonsodg.net Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4 On Fri, Jan 27, 2012 at 19:35, Bruno Rocha rochacbr...@gmail.com wrote: I am using /models just to define small global functions and to set some response and request keys. All my code including datamodels I am putting into /modules In my mind I changed the /models to /scripts or /batches so it is more easy to understand why avoiding it. my current structure is: /modules/datamodels/someentity.py - Database definitions /modules/handlers/someentity.py - my code logic and template rendering /modules/helpers/* - miscelanious /modules/myappname.py - My.custom Auth, db, Mail, Service etc.. /controllers/someentytity.py - it will just be a point of entry, here I do selective imports, intantiate the entities and call the template rendering. views files can be stored anywhere filesystem or database. http://zerp.ly/rochacbruno Em 27/01/2012 17:48, Magnitus eric_vallee2...@yahoo.ca escreveu: This is very good advice. I have moved many of my plugins and apps from using models to modules because of the performance gain. There is nothing wrong with the models implementation, but it's really meant to define tables and that's it. Functionality that doesn't belong in a controller should go to modules. Interesting, so to clarify: are you minimizing the amount of code into the model (limiting it to table definitions) or you avoid using a model at all?
[web2py] Re: Need help with selecting multiple rows into a single row
Alan, than you very much! Totally new concept for me, but you got exactly what I needed. I just fixed couple typos, and copying it here in case someone else needs to resolve a similar problem. rows = db(db.purchase_order.id0).select(db.purchase_order.po_number, db.item.id, left=db.item.on(db.purchase_order.id==db.item.po_id)) order_numbers = set([row.purchase_order.po_number for row in rows]) new_data = [[number,] + [str(row.item.id) for row in rows if row.purchase_order.po_number == number] for number in order_numbers] # print new_data # result: [['201201009', 291L], ['201201006', 261L], ['201201004', 161L, 171L], ['201201003', 151L, 231L], ['201201002', 111L, 211L], ['201201001', 31L, 41L, 51L, 61L]] new_data.insert(0, [purchase_order.po_number,]) max_fields = max([len(row) for row in new_data]) csv_output = for row in new_data: extra_fields = max_fields - len(row) csv_output += ,.join(row) + , * extra_fields + \n print csv_output #purchase_order.po_number #201201009,291,,, #201201006,261,,, #201201004,161,171,, #201201003,151,231,, #201201002,111,211,, #201201001,31,41,51,61 Thanks, Adnan
[web2py] Monitoring memory usage leaks
What tools / code snippets are you using to monitor memory leaks?
[web2py] Re: Cherokee deployment config
On Fri, 27 Jan 2012 11:23:22 -0430 Roberto Perdomo roberto...@gmail.com wrote: I have problems with the configuration of a server cherokee with we2py. Have you considered Cherokee + uWSGI? Sincerely, Gour -- In this endeavor there is no loss or diminution, and a little advancement on this path can protect one from the most dangerous type of fear. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature