[web2py] Re: Comparison doc for hosting a web2py app

2017-02-06 Thread Dave S
On Friday, February 3, 2017 at 6:14:59 PM UTC-8, Ron Chatterjee wrote:
>
> How do rack up $200/ month? I thought they only charge me $5 a month. 
>
>
That may be pythonanywhere is paying per node, with you $5 covering you 
access to that node.  I don't know how many nodes pythonanywhere might be 
using.
 

> Isn't that python anywhere is already assembled nicely to host web2py app 
> as oppose to others. Doesn't that comes into play for efficiency? I never 
> deployed anything on Amazon. How is that experience like?
>

Depends on which configuration you select.  I had a pretty easy time on AWS 
Linux, but I'm not being especially complex in my deployment.
 

/dps
 

>
> On Friday, February 3, 2017 at 2:22:29 PM UTC-5, Alex Glaros wrote:
>>
>> need to have more performance metrics posted on a permanent page 
>> somewhere to compare (and someone to update).  Example, does host provide 
>> Redis
>>
>> For my instance, PythonAnywhere runs on a $200/month Amazon "m3.xlarge" 
>> machine, which should be able to handle a lot of traffic.  Example, one of 
>> PythonAnywhere's users who's processing millions of hits a day is hardly 
>> using more than a few percent of its CPU and network bandwidth.
>>
>> Alex Glaros
>>
>

-- 
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] Fullcalendar scheduler

2017-02-06 Thread Richard Vézina
Here a pointer to an old post of I regarding fullcalendar :

https://groups.google.com/d/msg/web2py/GQFIMbNmp_M/ZiRHLUQ_UAAJ

Richard

On Mon, Feb 6, 2017 at 4:53 PM, Richard Vézina 
wrote:

> For my part, I create a json generating controller then in a dummy
> (controller that does nothing else than returning a empty string variable
> to the view) web2py view I initialiaze the fullcalendar plugin with json
> feed (https://fullcalendar.io/docs/event_data/events_json_feed/)...
>
> Good luck
>
> Richard
>
>
>
> On Sun, Feb 5, 2017 at 3:02 PM, Andrea Fae'  wrote:
>
>> Any people can tell me how to load from database table resources to show
>> using this add-on?
>>
>> https://fullcalendar.io/scheduler/
>>
>> Any suggestion? Thanks a lot
>>
>> --
>> 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.
>>
>
>

-- 
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] Fullcalendar scheduler

2017-02-06 Thread Richard Vézina
For my part, I create a json generating controller then in a dummy
(controller that does nothing else than returning a empty string variable
to the view) web2py view I initialiaze the fullcalendar plugin with json
feed (https://fullcalendar.io/docs/event_data/events_json_feed/)...

Good luck

Richard



On Sun, Feb 5, 2017 at 3:02 PM, Andrea Fae'  wrote:

> Any people can tell me how to load from database table resources to show
> using this add-on?
>
> https://fullcalendar.io/scheduler/
>
> Any suggestion? Thanks a lot
>
> --
> 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.
>

-- 
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: japronto

2017-02-06 Thread Richard Vézina
I guess partly for the same reason we can't make cpython faster (GIL -
https://wiki.python.org/moin/GlobalInterpreterLock)... But not only for
this reason of course. But let ask the question differently, why is
clienteside app faster? You move computer processing load to client in many
part, you reduce the size of the data that have to move back and forth as
you only have to transmit json instead of the whole DOM. Also, web2py can
be really fast, it all depends how you use it. For instance if you don't
need auth on every page you can avoid a lot of queries to the backend. The
same is true, you can use auth.has_membership() which triggers many queries
or you can initialize a varibale that you can cache for the duration of the
session. You use to check membership against this cached variable, that way
you avoid many queries to the backend which is most probably the bottleneck
of any application. The drawback is that you can't modify users privileges
once they are connected without maintaining the the cache variable up to
date (which is not that difficult you just have to make sure you update it
each time you manipulate membership) or ask them to logout and login again
when you modify their membership.

At some point if you really need more speed and you already have make it
sure your app is lean and properly tuned, you have to look on the side of
replication and redundancy...

You also have to gave a look at "model-less" app paradigm which involve
moving models definition into module which have some drawback. Before, that
make sure you don't defined any function into you models files, since the
code defined there is execute at each request. You can also activate lazy
table (
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Lazy-Tables--a-major-performance-boost
).

Also, notice that SSL has it pound in the balance... I had issue recently
since Chrome start to trigger error for certificate using SHA-1 hashing
key... I had to read and create a new private key... The out come despite
having a new secure certificate that pass Chrome validation was that using
Elliptic Curve key (https://www.digicert.com/ecc.htm) ECDSA 256 bits that
give an ssl certificate as secure as RSA 2048 bits (at least it said to be
as secure) which make ssl data encryption much faster. I wasn't able to
properly benchmark the speed improvement, but it seems as much as 25%
faster them my previous certficate.

Finally, Massimo is looking to find a solution that will allow us develop
client side app within web2py with help of ractivejs/vuejs (vuejs seems
much easier to pickup than ractive and much more well supported so I guess
it will win the battle). He had propose proof of concept in the past :

https://github.com/mdipierro/w3

But until now there were no traction from core developpers. Basically
because they are buzzy fixing issues and improving stuff (and speed :
https://groups.google.com/d/msg/web2py-developers/j6uxYMxo5qI/OQPEpJ5CWIoJ),
porting web2py over python 3 (https://github.com/web2py/web2py/issues/1353)
which turn to be a big undertake as we didn't have a new release for months
now.

>From what I do  understand, and I didn't have much time to follow and
contribute much recently, we are trying to make web2py build python 3
compliant then we will undertake others challenges.

In either way, once we will have web2py/web3py we will have to rewrite
(your are not forced because you will still be able to use python 2) our
apps, so Massimo is planning to seize the opportunity to break the promise
of backward compatibility and introducing client side goodies into web2py.
At least it's my understanding of what is going on rigth now.

Have a good day!

Richard


On Mon, Feb 6, 2017 at 11:23 AM, Ron Chatterjee 
wrote:

> Why can't we make web2py faster ?
>
>
> On Thursday, February 2, 2017 at 9:36:34 AM UTC-5, mcm wrote:
>>
>>
>> I agree nice and could be useful in speedy services and we should see if
>> it can be used in front of web2py.
>>
>> But it is more important for the long term that we start to think about
>> leveraging HTTP/2 soon
>>
>> Il giorno mercoledì 1 febbraio 2017 16:23:46 UTC+1, Anthony ha scritto:
>>>
>>> On Wednesday, February 1, 2017 at 4:54:31 AM UTC-5, Massimo Di Pierro
>>> wrote:

 I just discovered this:

 https://github.com/squeaky-pl/japronto

 I am impressed. I like the speed and the semantics.

>>>
>>> Seems interesting, though the benchmarks seem a bit contrived. It does
>>> so well because it uses HTTP pipelining with a workload designed to get
>>> maximum benefit from pipelining (24 identical and fast pipelined requests
>>> requiring no work in Python). Since most browsers do not support HTTP
>>> pipelining by default, and most workloads would not benefit so much from
>>> pipelining, this has little real world value. On the other hand, it does 
>>> *not
>>> *support HTTP/2 with request multiplexing, which *is *supported by most
>>> browsers and would li

[web2py] Re: SQLite lock (using DAL in a module)

2017-02-06 Thread Anthony
On Monday, February 6, 2017 at 11:20:41 AM UTC-5, MarkEdson AtWork wrote:
>
> Also consider that every time any http request is made that all of your 
> modules will be loaded.  It may be helpful to use cache.ram to store your 
> database connection so you can re-use it rather than creating a new 
> connection to the database on each request.
> something like...
>
> self.dal_db = cache.ram('test_database', lambda: DAL(
> 'sqlite://development.sqlite'), None)
>
>
You probably don't want to do that, as the db object should be created 
fresh for each request (to allow dynamic changes to model attributes that 
are isolated within the request). Note, for databases that support it 
(i.e., not SQLite), the DAL already maintains a cached connection pool of 
connections to the database, so you won't be reconnecting to the database 
on every request -- just instantiating a new DAL object and its models.

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: Deploy with postgresql

2017-02-06 Thread Richard Vézina
A tricks I use when adding new table to backend, since I don't want to turn
migration on over production system is to create an dummy app call
generate_sql for instance... When I add new table in my main app, I copy
the web2py model defined in the models file in the dummy app, access the
app for one turn to make the migration create the table in the backend
which is not using the same database. Then once the tables are created in
this other database, I use pgdaminIII to access the other db and take the
dml sql code then copy it in another instance of pgadmin pointing over my
production app and execute it. Then my table(s) is(are) created... Job done
as long as I didn't make any mistake in my web2py model definition in the
first place... If I did, I modify the model copy it in my generate_sql app
access the app, backend table get fix as there is no data into it. This may
fail some time if the modification made to the model are related to field
type modification since web2py migration can't delete field and there is
column type that can't be modify from one to the other. Those are related
to SQL limitations not web2py modification. I am not sure of that, but I
think that when there is not data web2py migration is able to delete and
recreate a field for which type change in a way that require the column to
be dropped and recreate.

So far, this approach save me a lot of work to manually create table in
SQL, I can write once model in web2py.

I know it not ideal and kind of not respecting the workflow of web2py
thought the web2py migration are not affordable to me in case of live
system that contains a lot of data who is still under developpement. So, to
avoid any risk of losing information, I adopted this practice long time ago.

Richard

On Mon, Feb 6, 2017 at 12:28 PM, MarkEdson AtWork 
wrote:

> If the code that reads AppConfig can't handle whitespace then this bug
> should definitely be fixed!
> This type of bug can be very difficult to find because it is so esoteric.
>
> On Sunday, February 5, 2017 at 12:26:51 AM UTC-8, Ben Lawrence wrote:
>>
>> ok, my dumbness
>> the AppConfig module doesn't like '=' not aligned so instead of this
>> ; db configuration
>> [db]
>> uri= postgres://x:x/
>> migrate= 1
>> pool_size = 10
>>
>> I had this
>> [db]
>> uri  = postgres://x:x/
>> migrate= 1
>> pool_size = 10
>>
>> and that is why as I understand, that last description didn't work!
>>
>>
>> On Wednesday, December 28, 2016 at 6:18:10 AM UTC+8, Mark Graves wrote:
>>>
>>> Hopefully this is solved, but a simple test is to use the original
>>> appconfig.ini with storage.sqlite as the connection string.
>>>
>>> That will tell you if it is a syntax problem, at least.
>>>
>>> -Mark
>>>
>>>
>>>
>>> On Monday, December 26, 2016 at 7:08:23 PM UTC-6, Ben Lawrence wrote:

 seems to be an appconfig problem. if I don't use appconfig.ini and
 place the info in db.py, everything works.

 On Friday, December 23, 2016 at 6:16:12 AM UTC-8, Ben Lawrence wrote:
>
> Andre, did you solve this? For me pg 9.5 on remote ubuntu 16, web2py
> is not creating the tables.
>
> On Sunday, September 4, 2016 at 6:55:54 AM UTC-7, Morganti wrote:
>>
>> Hi people!
>>
>> I just almost in go-live. So, I tried to create a Postgresql database
>> and starting to configure some config tables for my appliacation, but I 
>> had
>> the error below.
>>
>> Traceback (most recent call last):
>>   File 
>> "/home/andre/Dropbox/Projetos/web2py/applications/87k/controllers/appadmin.py",
>>  line 249, in select
>> nrows = db(query, ignore_common_filters=True).count()
>>   File 
>> "/home/andre/Dropbox/Projetos/web2py/gluon/packages/dal/pydal/objects.py",
>>  line 2010, in count
>> return db._adapter.count(self.query, distinct)
>>   File 
>> "/home/andre/Dropbox/Projetos/web2py/gluon/packages/dal/pydal/adapters/base.py",
>>  line 1322, in count
>> return self.cursor.fetchone()[0]
>> IndexError: list index out of range
>>
>> Thanks
>> Best regards
>> André
>>
>>
>> --
> 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.
>

-- 
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

[web2py] Re: memory leak - model remains in memory after requests

2017-02-06 Thread Anthony
On Friday, February 3, 2017 at 4:05:55 PM UTC-5, MarkEdson AtWork wrote:
>
> I found a similar issue with a db.py module with code like this in it...
>
> from gluon.packages.dal.pydal import DAL, Field
> db = DAL("sqlite://storage.sqlite")
> db.define_table(
> "test",
> Field("myid", default=DEFAULT_VALUE, length=15),
> Field("name", default=DEFAULT_VALUE, length=15),
> Field("code", default=DEFAULT_VALUE, length=2),
>  )
>
>
How are you using that module within your app?

Most likely, you should not be defining the db object at the top level of 
your module. If you do that, you will have a single db object that lives 
across all requests. The problem with that is if you dynamically change any 
attributes of any models in some requests (e.g., temporarily changing the 
default value or validator of a field), those changes will persist across 
all requests (until changed again somewhere else).

Instead, you should define the db object and its models for each request. 
If you want to keep the code in a module, put it inside of functions or 
classes and call those functions/classes from your app's model or 
controller code.

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: memory leak - model remains in memory after requests

2017-02-06 Thread Dave S


On Monday, February 6, 2017 at 9:00:21 AM UTC-8, MarkEdson AtWork wrote:
>
> I should also mention that I recently updated my code to use multiple 
> controllers.
>
> On Monday, February 6, 2017 at 7:53:20 AM UTC-8, MarkEdson AtWork wrote:
>>
>> Update, 
>> I ran the sample code I placed in this post over the weekend and it ended 
>> up consuming 1.8GB before python stopped functioning.
>> I am running pyDAL (17.1) with a stable web2py release.
>> Is this the built-in Rocket server issue I have run into?
>>
>
I run web2py with Rocket in a variety of environments.  The one on AWS 
Linux, according to top, scoots up to 3.4% mem occasionally; there's a main 
process and a scheduler running.  It's been running for at least a month 
since the last restart, but doesn't have a heavy load.  My dev environment 
is a Centos machine, with slightly more load but still not anything 
serious.  I've never run out of memory on it.  The "toy" environment on 
Windows doesn't generally run for more than a couple weeks at a time, but 
behaves itself during its uptime.

/dps

-- 
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: Deploy with postgresql

2017-02-06 Thread MarkEdson AtWork
If the code that reads AppConfig can't handle whitespace then this bug 
should definitely be fixed!
This type of bug can be very difficult to find because it is so esoteric.

On Sunday, February 5, 2017 at 12:26:51 AM UTC-8, Ben Lawrence wrote:
>
> ok, my dumbness
> the AppConfig module doesn't like '=' not aligned so instead of this
> ; db configuration
> [db]
> uri= postgres://x:x/
> migrate= 1
> pool_size = 10
>
> I had this
> [db]
> uri  = postgres://x:x/  
> migrate= 1
> pool_size = 10 
>
> and that is why as I understand, that last description didn't work!
>
>
> On Wednesday, December 28, 2016 at 6:18:10 AM UTC+8, Mark Graves wrote:
>>
>> Hopefully this is solved, but a simple test is to use the original 
>> appconfig.ini with storage.sqlite as the connection string.
>>
>> That will tell you if it is a syntax problem, at least.
>>
>> -Mark
>>
>>
>>
>> On Monday, December 26, 2016 at 7:08:23 PM UTC-6, Ben Lawrence wrote:
>>>
>>> seems to be an appconfig problem. if I don't use appconfig.ini and place 
>>> the info in db.py, everything works.
>>>
>>> On Friday, December 23, 2016 at 6:16:12 AM UTC-8, Ben Lawrence wrote:

 Andre, did you solve this? For me pg 9.5 on remote ubuntu 16, web2py is 
 not creating the tables.

 On Sunday, September 4, 2016 at 6:55:54 AM UTC-7, Morganti wrote:
>
> Hi people!
>
> I just almost in go-live. So, I tried to create a Postgresql database 
> and starting to configure some config tables for my appliacation, but I 
> had 
> the error below.
>
> Traceback (most recent call last):
>   File 
> "/home/andre/Dropbox/Projetos/web2py/applications/87k/controllers/appadmin.py",
>  line 249, in select
> nrows = db(query, ignore_common_filters=True).count()
>   File 
> "/home/andre/Dropbox/Projetos/web2py/gluon/packages/dal/pydal/objects.py",
>  line 2010, in count
> return db._adapter.count(self.query, distinct)
>   File 
> "/home/andre/Dropbox/Projetos/web2py/gluon/packages/dal/pydal/adapters/base.py",
>  line 1322, in count
> return self.cursor.fetchone()[0]
> IndexError: list index out of range
>
> Thanks
> Best regards
> André
>
>
>

-- 
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: memory leak - model remains in memory after requests

2017-02-06 Thread MarkEdson AtWork
I should also mention that I recently updated my code to use multiple 
controllers.

On Monday, February 6, 2017 at 7:53:20 AM UTC-8, MarkEdson AtWork wrote:
>
> Update, 
> I ran the sample code I placed in this post over the weekend and it ended 
> up consuming 1.8GB before python stopped functioning.
> I am running pyDAL (17.1) with a stable web2py release.
> Is this the built-in Rocket server issue I have run into?
>
> On Friday, December 24, 2010 at 4:16:24 PM UTC-8, David Zejda wrote:
>>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> My web2py instance gradually eats memory, during day the consumption
>> grows up to several gigs, so I have to restart often. According to guppy
>> most of memory is occupied by gluon.dal.Field and other classes of dal:
>>
>> Partition of a set of 3231760 objects. Total size = 443724152 bytes.
>>  Index  Count   % Size   % Cumulative  % Kind
>>  0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
>>  1 1324208  41 80561096  18 270197664  61 str
>>  2 328642  10 15982732   4 286180396  64 tuple
>>  3  26637   1 13851240   3 300031636  68 dict of
>> gluon.validators.IS_IN_DB
>>  4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
>>  5  20042   1 13344464   3 326812356  74 dict (no owner)
>>  6   8199   0 11860464   3 338672820  76 gluon.dal.Row
>>  7  16615   1 11482224   3 350155044  79 gluon.dal.Table
>>  8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
>>  9 137779   4  7363776   2 366179572  83 list
>> <2282 more rows. Type e.g. '_.more' to view.>
>>
>> The proportion is relatively stable. It seems that model definition
>> remains in memory after each request. It is probably caused by a weird
>> reference, but I'm not sure how to track it. Please do you have any ideas?
>>
>> Thanks :)
>> David
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.9 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
>> ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
>> =9cqX
>> -END PGP SIGNATURE-
>>
>>

-- 
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: Payment gateway working app using AuthorizNet

2017-02-06 Thread Ron Chatterjee
There seem to be some bug or something because I implemented it and the 
payment didn't go through . Any doc to support the module?

On Tuesday, January 31, 2017 at 8:56:41 PM UTC-5, Massimo Di Pierro wrote:
>
> There is an example in gluon/contrib/AuthorizeNet.py but I do not think 
> anybody used that in year.
>
> On Monday, 30 January 2017 15:35:00 UTC-6, Ron Chatterjee wrote:
>>
>> Is there a fully working version of payment gateway using AuthorizeNet 
>> that anyone can share?
>>
>>

-- 
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: japronto

2017-02-06 Thread Ron Chatterjee
Why can't we make web2py faster ?

On Thursday, February 2, 2017 at 9:36:34 AM UTC-5, mcm wrote:
>
>
> I agree nice and could be useful in speedy services and we should see if 
> it can be used in front of web2py.
>
> But it is more important for the long term that we start to think about 
> leveraging HTTP/2 soon
>
> Il giorno mercoledì 1 febbraio 2017 16:23:46 UTC+1, Anthony ha scritto:
>>
>> On Wednesday, February 1, 2017 at 4:54:31 AM UTC-5, Massimo Di Pierro 
>> wrote:
>>>
>>> I just discovered this:
>>>
>>> https://github.com/squeaky-pl/japronto
>>>
>>> I am impressed. I like the speed and the semantics.
>>>
>>
>> Seems interesting, though the benchmarks seem a bit contrived. It does so 
>> well because it uses HTTP pipelining with a workload designed to get 
>> maximum benefit from pipelining (24 identical and fast pipelined requests 
>> requiring no work in Python). Since most browsers do not support HTTP 
>> pipelining by default, and most workloads would not benefit so much from 
>> pipelining, this has little real world value. On the other hand, it does 
>> *not 
>> *support HTTP/2 with request multiplexing, which *is *supported by most 
>> browsers and would likely have real benefits for more typical workloads.
>>
>> Regarding the API, how do you think it compares with Sanic 
>>  (also based on uvloop 
>> and allowing async handlers)?
>>
>> 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: SQLite lock (using DAL in a module)

2017-02-06 Thread MarkEdson AtWork
Also consider that every time any http request is made that all of your 
modules will be loaded.  It may be helpful to use cache.ram to store your 
database connection so you can re-use it rather than creating a new 
connection to the database on each request.
something like...

self.dal_db = cache.ram('test_database', lambda: DAL(
'sqlite://development.sqlite'), None)


in your open_connection code might get you past this at least until you 
find out the ultimate solution.  

Best of luck...


On Sunday, February 5, 2017 at 7:12:26 AM UTC-8, Jesse Hunt wrote:
>
> Good afternoon all,
>
> I am experiencing issues while trying to perform operations using my DAL 
> from a module. I recently moved code from the default controller to a 
> module for better coding practices. The code was running previous to the 
> move, but now I experience an error (  
> database is locked ) everytime I try to run it.
>
> So far, I have tried:
>
>- various additions of small snippets I thought might help me fix the 
>problem from 
>http://www.web2pyslices.com/slice/show/1478/using-modules-in-web2py
>- enabling WAL in SQLite from this thread 
>
> https://groups.google.com/forum/#!msg/web2py/2IDEb658VDw/f5jv54bOH30J;context-place=forum/web2py
>
> But after searching for the last 3 days, I can not find a solution that 
> matches up with my problem. I will post the code relevant to what is 
> happening. 
> FYI:
>
>- There is a scheduler running
>- The following code is running within a module
>- I executed the WAL statement in the default controller
>
> from gluon import current
> from gluon.dal import DAL, Field
> import pymongo
> from datetime import datetime as dt
> from datetime import date
>
>
> class mongo_functions:
> client = None
> connection = None
> mongo_db = None
> db_name = None
> collection = None
> collection_name = None
> dal_name = None
> dal_db = None
>
>
> def __init__(self, connection=None, db_name=None, collection_name=None
> , dal_name=None):
>
>
> # if settings returns nothing, connect to local DB
> if connection is None:
> self.connection = 'mongodb://localhost:27017/'
> if db_name is None:
> self.db_name = 'test_database'
> if collection_name is None:
> self.collection_name = 'test_s_collection'
> if dal_name is None:
> self.dal_name = 'sqlite://development.sqlite'
>  
> # added after looking at slice referenced above
> self.session = current.session
> self.request = current.request
> self.response = current.response
> self.cache = current.cache
>
>
> def open_connection(self):
> self.client = pymongo.MongoClient(self.connection)
> self.mongo_db = self.client[self.db_name]
> self.collection = self.mongo_db[self.collection_name]
> self.dal_db = DAL(self.dal_name)
> print "Connection to Mongo and DAL open"
>
>
> def close_connection(self):
> self.collection = None
> self.mongo_db = None
> self.client.close()
> self.dal_db = None
>
> # the method below refuses to format itself correctly, assume the 
> tabulation is fine
> def query_for_service(self, security_name, field, start_date, end_date
> , session_id):
>  self.dal_db.define_table('export_service',
>  Field('security_name', notnull=True),
>  Field('field', notnull=True),
>  Field('date', type='date'),
>  Field('value'),
>  Field('session_id'),
>  format='%(name)-(field)-(date)s')
>
>
> queried_document = collection.find_one({'sec_name': security_name, 
> 'field': field})
> # data_set is a list of date/value dictionary objects
> data_set = queried_document['data']
>
>
> # a data_point is a dictionary object with date and value pairs.
> for data_point in data_set:
> date_object = data_point['date'].date()
>
>
> print start_date
> print end_date
> print date_object
>
>
> export_list = list()
>
>
> if date_object > start_date and date_object < end_date:
> value = data_point['value']
>
>
> value_dict = {'security_name': security_name, 'field': field, 
> 'date': date_object, 'value': value,
>   'session_id': session_id}
> export_list.append(value_dict)
>
>
> self.dal_db.export_service.bulk_insert(export_list)
> self.dal_db.commit()
>
> *Thank you in advance for your time, I very sincerely appreciate 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 
"web

[web2py] Re: memory leak - model remains in memory after requests

2017-02-06 Thread MarkEdson AtWork
Update, 
I ran the sample code I placed in this post over the weekend and it ended 
up consuming 1.8GB before python stopped functioning.
I am running pyDAL (17.1) with a stable web2py release.
Is this the built-in Rocket server issue I have run into?

On Friday, December 24, 2010 at 4:16:24 PM UTC-8, David Zejda wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> My web2py instance gradually eats memory, during day the consumption
> grows up to several gigs, so I have to restart often. According to guppy
> most of memory is occupied by gluon.dal.Field and other classes of dal:
>
> Partition of a set of 3231760 objects. Total size = 443724152 bytes.
>  Index  Count   % Size   % Cumulative  % Kind
>  0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
>  1 1324208  41 80561096  18 270197664  61 str
>  2 328642  10 15982732   4 286180396  64 tuple
>  3  26637   1 13851240   3 300031636  68 dict of
> gluon.validators.IS_IN_DB
>  4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
>  5  20042   1 13344464   3 326812356  74 dict (no owner)
>  6   8199   0 11860464   3 338672820  76 gluon.dal.Row
>  7  16615   1 11482224   3 350155044  79 gluon.dal.Table
>  8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
>  9 137779   4  7363776   2 366179572  83 list
> <2282 more rows. Type e.g. '_.more' to view.>
>
> The proportion is relatively stable. It seems that model definition
> remains in memory after each request. It is probably caused by a weird
> reference, but I'm not sure how to track it. Please do you have any ideas?
>
> Thanks :)
> David
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
> ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
> =9cqX
> -END PGP SIGNATURE-
>
>

-- 
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] SQLite lock (using DAL in a module)

2017-02-06 Thread Michele Comitini
@Jesse

SQLite has to be seen as a signle file storage.  If you open in one process
all other processes have to wait until the first process releases lock
ownership.  The best way to do that, is to put commit or rollback at the
end of every access on the db.
The code you posted does a single commit when the class is instantiated, if
I understand correctly, so the application ends up with very long
transactions... hence the lock



2017-02-05 23:12 GMT+01:00 António Ramos :

>  (i´m not an expert here but i faced the same problem)
> I moved to postgresql and no more database locks.
> sqlite does not allow to have scheduler and your code writting to the
> database at the same , or at least that was my understanding...
>
> Regards
> António
>
>
> 2017-02-03 14:01 GMT+00:00 Jesse Hunt :
>
>> Good afternoon all,
>>
>> I am experiencing issues while trying to perform operations using my DAL
>> from a module. I recently moved code from the default controller to a
>> module for better coding practices. The code was running previous to the
>> move, but now I experience an error ( 
>> database is locked ) everytime I try to run it.
>>
>> So far, I have tried:
>>
>>- various additions of small snippets I thought might help me fix the
>>problem from http://www.web2pyslices.com/slice/show/1478/using-modul
>>es-in-web2py
>>- enabling WAL in SQLite from this thread https://groups.google.c
>>om/forum/#!msg/web2py/2IDEb658VDw/f5jv54bOH30J;context-
>>place=forum/web2py
>>
>> 
>>
>> But after searching for the last 3 days, I can not find a solution that
>> matches up with my problem. I will post the code relevant to what is
>> happening.
>> FYI:
>>
>>- There is a scheduler running
>>- The following code is running within a module
>>- I executed the WAL statement in the default controller
>>
>> from gluon import current
>> from gluon.dal import DAL, Field
>> import pymongo
>> from datetime import datetime as dt
>> from datetime import date
>>
>>
>> class mongo_functions:
>> client = None
>> connection = None
>> mongo_db = None
>> db_name = None
>> collection = None
>> collection_name = None
>> dal_name = None
>> dal_db = None
>>
>>
>> def __init__(self, connection=None, db_name=None, collection_name=
>> None, dal_name=None):
>>
>>
>> # if settings returns nothing, connect to local DB
>> if connection is None:
>> self.connection = 'mongodb://localhost:27017/'
>> if db_name is None:
>> self.db_name = 'test_database'
>> if collection_name is None:
>> self.collection_name = 'test_s_collection'
>> if dal_name is None:
>> self.dal_name = 'sqlite://development.sqlite'
>>
>> # added after looking at slice referenced above
>> self.session = current.session
>> self.request = current.request
>> self.response = current.response
>> self.cache = current.cache
>>
>>
>> def open_connection(self):
>> self.client = pymongo.MongoClient(self.connection)
>> self.mongo_db = self.client[self.db_name]
>> self.collection = self.mongo_db[self.collection_name]
>> self.dal_db = DAL(self.dal_name)
>> print "Connection to Mongo and DAL open"
>>
>>
>> def close_connection(self):
>> self.collection = None
>> self.mongo_db = None
>> self.client.close()
>> self.dal_db = None
>>
>> # the method below refuses to format itself correctly, assume the
>> tabulation is fine
>> def query_for_service(self, security_name, field, start_date,
>> end_date, session_id):
>>  self.dal_db.define_table('export_service',
>>  Field('security_name', notnull=True),
>>  Field('field', notnull=True),
>>  Field('date', type='date'),
>>  Field('value'),
>>  Field('session_id'),
>>  format='%(name)-(field)-(date)s')
>>
>>
>> queried_document = collection.find_one({'sec_name': security_name,
>> 'field': field})
>> # data_set is a list of date/value dictionary objects
>> data_set = queried_document['data']
>>
>>
>> # a data_point is a dictionary object with date and value pairs.
>> for data_point in data_set:
>> date_object = data_point['date'].date()
>>
>>
>> print start_date
>> print end_date
>> print date_object
>>
>>
>> export_list = list()
>>
>>
>> if date_object > start_date and date_object < end_date:
>> value = data_point['value']
>>
>>
>> value_dict = {'security_name': security_name, 'field': field,
>> 'date': date_object, 'value': value,
>>   'session_id': session_id}
>> export_list.append(value_d

[web2py] MULTIPLE APPLICATIONS IN SAME HOST/SUBDOMAINS WITH NGINX

2017-02-06 Thread Áureo Dias Neto
Hello guys,

how i'm host more than one application, in the same server, with 
sub-domains on nginx?

example: http://192.168.1.13/app1 -> 'app1'
http://192.168.1.13/app2 -> 'app2'

-- 
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.