[web2py] Re: compiling application ?
try this cd /home/w2p/web2py python -c "import gluon.compileapp; gluon.compileapp.compile_application('applications/myapp')" # for using gzip compression with nginx # https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-14-04 # replace in zip_static_files.py print with print() # python web2py.py -S myapp -R scripts/zip_static_files.py | grep -v skip cd - --- среда, 28 февраля 2018 г., 2:26:10 UTC+3 пользователь Yoel Benitez Fonseca написал: > > Is there a way of compiling a web2py application from the command line ? > > -- > Msc. Yoel Benítez Fonseca > -- 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: gevent and web2py
I think you can, but how is this related to web2py? I mean, you can even run gevent inside a function in a controller if you want. Like in the example, if you have an action that needs to check if three URLs are available, it will return faster if you query those URLs asynchronously (using gevent, or asyncio, or Twisted, etc.) El jueves, 1 de marzo de 2018, 13:04:35 (UTC-3), Pierre escribió: > > Hi, > > Can I use* gevent* to build a homemade redis task queue and to execute > these tasks? Does it make sense ? sorry if this is naiv questions i'm new > to async programming... > > > http://web2py.com/books/default/chapter/29/08/emails-and-sms?search=homemade > > > from http://www.gevent.org/intro.html: > > > The following example shows how to run tasks concurrently: > > > >>> import gevent>>> from gevent import socket>>> urls = ['www.google.com', > >>> 'www.example.com', 'www.python.org']>>> jobs = > >>> [gevent.spawn(socket.gethostbyname, url) for url in urls]>>> > >>> gevent.joinall(jobs, timeout=2)>>> [job.value for job in > >>> jobs]['74.125.79.106', '208.77.188.166', '82.94.164.162' > > -- 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 many concurrent requests can a web2py instance handle?
I know this is probably not a specific web2py issue, but rather a WSGI one. I am somewhat confused. However, this is not the largely discussed "Does web2py scale?" question. I am wondering if a single web2py instance can handle two or more requests concurrently, or if two users access to the site at the same time, then one request is queued up? I am deploying a site in PythonAnywhere for a small business, with 4 web workers. I guess that means 4 web2py processes and that the webserver will dispatch incoming requests to one idle process of those four? Thanks in advance! -- 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: Option to load modified appconfig in rocket server
On Friday, March 2, 2018 at 4:13:21 AM UTC-5, Yan Wong wrote: > > Anthony: I'm assuming that on my production server, which is run through > uwsgi, the 'args' argument is typically not used, so this won't interfere > with anything? > cmd_options should only appear when running web2py via the command line (i.e., python web2py.py ...), so it won't be present for requests served via uwsgi, though it will be there when the scheduler is running a task. 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: please help us test trunk web2py
Thanks. I've already cloned. But remained confused how to update correctly. Normally I would just "git pull" but am not sure if I need to do something else to make sure DAL updated, too. -- 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: Unexpected behaviour executing a query with DAL and record versioning enabled
Hmmm... I think that if you have record versioning activated there shouldn't be any is_active row(s) with NULL value... I mean is_active flag is used to determine if the record in the "parent" table has been deleted or not, since you can truely deleted in case you use record versioning feature as all the previous record stated records contained in the versioning table reference the parent record in the parent table... And you see in the second example here : http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=record+versioning#Record-versioning That is_active is set to default=True and there is this note : Notice the hidden boolean field called is_active and defaulting to True. So if you have activated record versioning feature over an already existing table you need to set is_active to TRUE for all the existing record once you start using the versioning feature and set the is_active to be mandatory... I guess it would make sens to change seconde book example in orther that is should be more obvious that is_active is mandatory like so : db.define_table('stored_item', Field('name'), Field('quantity', 'integer'), Field('is_active', 'boolean', writable=False, readable=False, default=True, required=True, requires=IS_NOT_EMPTY())) That way you don't need to care about null value to get all the records of the parent table and DAL is not bugged... Richard On Fri, Mar 2, 2018 at 9:22 AM, 'Awe' via web2py-users < web2py@googlegroups.com> wrote: > So, I did check it again: > > It seems that DAL is not able to handle a left join using ISNULL condition > in combination with enabled record versioning. > There are two "is active" checks within the left join: OK > The next two upcoming ANDs to check "is_active" are not necessary and > actually prohibit the query to work properly. > To make this work it should be: AND (("test1"."is_active" = 'T') AND > (("test2"."is_active" = 'T' OR ("test2"."is_active" ISNULL )) > The two AND is active checks at the end of the query are not necessary at > all (my opinion). > > Could somebody please verifiy this! > Andreas > > > Am Donnerstag, 1. März 2018 13:37:59 UTC+1 schrieb Awe: >> >> Hello, >> I post a simple step by step example, to explain. >> Doing a left join and using a where clause like: table.field==None >> Depending on _enable_record_versioning is enabled or not, I get different >> results when executing the identical query. >> The result when versioning is DISABLED is the correct one. >> >> 2.15.4-stable+timestamp.2017.09.02.04.02.22 >> (läuft auf Rocket 1.2.6, Python 2.7.12) >> SQLite DB >> >> Example: >> >> #simple table: >> current.db.define_table('test', >>Field('title', 'string'), >>Field('granny', 'reference test'), # convenience - >> topmost >>Field('type_marker', 'string'), >>auth.signature, >>) >> #versioning, enable/disable it >> current.db.test._enable_record_versioning(archive_db=current.db, >> archive_name='test_archive', >> current_record='current_record', >> is_active='is_active' >> ) >> >> #put some data in >> #current.db.test.insert(**{'title': 'Peter', 'granny': None, >> 'type_marker': 'person'}) >> #current.db.test.insert(**{'title': 'Paul', 'granny': None, >> 'type_marker': 'person'}) >> #current.db.test.insert(**{'title': 'Laptop', 'granny': 2, >> 'type_marker': 'object'}) >> >> #so you get table content (enabled)t: >> test.idtest.titletest.grannytest.type_marker >> test.is_activetest.created_ontest.created_by >> test.modified_ontest.modified_by >> 1 Peter Noneperson >> True2018-03-01 08:11:40Me2018-03-01 >> 08:11:40Me >> 2 Paul Noneperson >> True2018-03-01 08:11:40Me2018-03-01 >> 08:11:40Me >> 3 Laptop 2 object >> True2018-03-01 08:11:40Me2018-03-01 >> 08:11:40Me >> >> #simple controller function >> def demo(): >> test1=current.db.test.with_alias('test1') >> test2=current.db.test.with_alias('test2') >> query = (test2.type_marker=='object') | (test2.type_marker==None) & >> (test1.type_marker=='person') >> tbl = current.db().select(current.db.test.ALL) >> rows = current.db(query).select(test1.title, test2.title, >> left=test2.on(test1.id==test2.granny)) >> prn = current.db(query)._select(test1.title, test2.title, >> left=test2.on(test1.id==test2.granny)) >> return dict(tbl=tbl, rows=rows, prn=prn) >> >> Result/Output: >> test1.titletest2.title >> PaulLaptop >> >> Raw SQL: >> SELECT "test1"."title",
[web2py] Re: Unexpected behaviour executing a query with DAL and record versioning enabled
So, I did check it again: It seems that DAL is not able to handle a left join using ISNULL condition in combination with enabled record versioning. There are two "is active" checks within the left join: OK The next two upcoming ANDs to check "is_active" are not necessary and actually prohibit the query to work properly. To make this work it should be: AND (("test1"."is_active" = 'T') AND (("test2"."is_active" = 'T' OR ("test2"."is_active" ISNULL )) The two AND is active checks at the end of the query are not necessary at all (my opinion). Could somebody please verifiy this! Andreas Am Donnerstag, 1. März 2018 13:37:59 UTC+1 schrieb Awe: > > Hello, > I post a simple step by step example, to explain. > Doing a left join and using a where clause like: table.field==None > Depending on _enable_record_versioning is enabled or not, I get different > results when executing the identical query. > The result when versioning is DISABLED is the correct one. > > 2.15.4-stable+timestamp.2017.09.02.04.02.22 > (läuft auf Rocket 1.2.6, Python 2.7.12) > SQLite DB > > Example: > > #simple table: > current.db.define_table('test', >Field('title', 'string'), >Field('granny', 'reference test'), # convenience - > topmost >Field('type_marker', 'string'), >auth.signature, >) > #versioning, enable/disable it > current.db.test._enable_record_versioning(archive_db=current.db, > archive_name='test_archive', > current_record='current_record', > is_active='is_active' > ) > > #put some data in > #current.db.test.insert(**{'title': 'Peter', 'granny': None, > 'type_marker': 'person'}) > #current.db.test.insert(**{'title': 'Paul', 'granny': None, 'type_marker': > 'person'}) > #current.db.test.insert(**{'title': 'Laptop', 'granny': 2, 'type_marker': > 'object'}) > > #so you get table content (enabled)t: > test.idtest.titletest.grannytest.type_marker > test.is_activetest.created_ontest.created_by > test.modified_ontest.modified_by > 1 Peter Noneperson > True2018-03-01 08:11:40Me2018-03-01 > 08:11:40Me > 2 Paul Noneperson > True2018-03-01 08:11:40Me2018-03-01 > 08:11:40Me > 3 Laptop 2 object > True2018-03-01 08:11:40Me2018-03-01 > 08:11:40Me > > #simple controller function > def demo(): > test1=current.db.test.with_alias('test1') > test2=current.db.test.with_alias('test2') > query = (test2.type_marker=='object') | (test2.type_marker==None) & > (test1.type_marker=='person') > tbl = current.db().select(current.db.test.ALL) > rows = current.db(query).select(test1.title, test2.title, > left=test2.on(test1.id==test2.granny)) > prn = current.db(query)._select(test1.title, test2.title, > left=test2.on(test1.id==test2.granny)) > return dict(tbl=tbl, rows=rows, prn=prn) > > Result/Output: > test1.titletest2.title > PaulLaptop > > Raw SQL: > SELECT "test1"."title", "test2"."title" FROM "test" AS "test1" LEFT JOIN > "test" AS "test2" ON (("test1"."id" = "test2"."granny") AND > (("test1"."is_active" = 'T') AND ("test2"."is_active" = 'T'))) WHERE > "test2"."type_marker" = 'object') OR (("test2"."type_marker" IS NULL) > AND ("test1"."type_marker" = 'person'))) AND (("test1"."is_active" = 'T') > AND ("test2"."is_active" = 'T'))) AND (("test1"."is_active" = 'T') AND > ("test2"."is_active" = 'T'))); > > > NOW DISABLED Record versioning: > > Result/Output: > test1.titletest2.title > PeterNone > PaulLaptop > > Raw SQL: > SELECT "test1"."title", "test2"."title" FROM "test" AS "test1" LEFT JOIN > "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE > (("test2"."type_marker" = 'object') OR (("test2"."type_marker" IS NULL) AND > ("test1"."type_marker" = 'person'))); > > QUESTION: > The result with versioning turned off looks right. > It seems that the automatically inserted "AND... is_active" clauses are > not correct. > Many thanks for your help and assistance. > Andreas > > -- 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] Back button with an Ajax LOAD page
Hello. I've made a product page with the Ajax LOAD system: http://www.mompala.it/prodotti The idea is giving the possibility to the user to browse these products without a page reload, and it works fine. The problem is that browsing the products don't change the url. I've made a script that changes the content depending of the url. If the url has a category_id like http://www.mompala.it/prodotti?category_id=8 the load page will display the products of this category. If the url has a product_id like http://www.mompala.it/prodotti?product_id=325 the load page will display this product. The problem still the history. The user must have the possibility to press the browser back button for displaying the last content. Adding this script in the load page change the url in the browser url bar, new_link is a link with the category_id or product_id: history.pushState("", "", "{{=new_link}}"); Like that the back button change only the url bar content, not the page content. For updating the page content I've added in the main page 'prodotti' this script: window.addEventListener('popstate', function(event) { location.reload(); }); And it works, but only for turning back to the last page. In other words, if the user wanted to turn back in the history 2 pages in the past he can't. Someones knows why? 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: Option to load modified appconfig in rocket server
Anthony: I'm assuming that on my production server, which is run through uwsgi, the 'args' argument is typically not used, so this won't interfere with anything? I can't find much documentation about request.env.cmd_options.args. Cheers Yan On Thursday, 1 March 2018 12:23:44 UTC, Anthony wrote: > > And if you want to pass the config filename directly to Rocket, you can > re-purpose its "args" argument (which is typically only used when running > scripts via the command line): > -- 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.