[web2py] SQLFORM.widget form field length style change after submit

2016-07-13 Thread 黄祥
let say i have a code
*models/db.py*
db.test.name.requires = IS_NOT_EMPTY()
db.test.address.requires = IS_NOT_EMPTY()
db.test.name.widget = lambda field,value: 
SQLFORM.widgets.string.widget(field, value, 
_placeholder = T('Name should be filled') )
db.test.address.widget = lambda field,value: 
SQLFORM.widgets.text.widget(field, value, 
_placeholder = T('Address should be filled') )

The placeholder is shown in form field, after i submit with empty data, the 
form field length style is change. 
is it normal or did i miss something in my code?

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Nginx & The Welcome App

2016-07-13 Thread pbreit
I think the path to web2py is typically specified in the uwsgi ini file.

Something like:
pythonpath = /home/www-data/web2py/

Even if you don't use it, the install script can be helpful to look at:

https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

-- 
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] Hide flash message after some elapsed time instead of on click

2016-07-13 Thread Jim Brouzoulis
Thank you very much for your help! (...and sorry for the late reply)

It didn't work at first but then I noticed a typo: the class should be 
'.w2p_flash'.

Regards
// Jim


Den måndag 11 juli 2016 kl. 10:49:08 UTC+2 skrev Massimiliano:
>
> Hi Jim, 
> I’m doing it in this way:
>
> Edit static/web2py.js search for /*helper for flash messages*/
>
> and add this command:
>
> setTimeout(‘jQuery(".flash").fadeOut("slow")',5000);
>
> just after:
>
> if (flash.html()) flash.append('  
> ').slideDown();
>
> Adjust 5000 that stands for 5 secods to your needs.
>
>
> On Thu, Jul 7, 2016 at 6:00 PM, Jim Brouzoulis  > wrote:
>
>> Hi everyone,
>>
>> Can I easily customise the web2py.js file to automatically hide/fade out 
>> the flash message after some given time (like a few seconds) instead of 
>> clicking on it? If so, how? 
>> I have a feeling that the solution is probably not that complicated but 
>> my js-skills aren't very impressive :)
>>
>> Regards
>> // Jim
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Massimiliano
>

-- 
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: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Dave S


On Wednesday, July 13, 2016 at 12:30:16 PM UTC-7, Chetan Jain wrote:
>
> while running this file, db is locked.
> What to do in such case?
>
> I find this answer:
>
> if you can, use a separate db for the scheduler. SQLite doesn't handle 
> well concurrent writes (with default operational capabilities), so having 
> the scheduler operating on the same database of your "insertion" of 
> messages can lead to locks.
> [...]
>
 

>
> i'm not clear with it
>
> Best,
> Chetan Jain
>
>
Sqlite has more limitations than the "big database engines" like MySQL and 
and Postgres.  One of those limitations is that  it can't handle parallel 
accesses to the database.  If you're using Sqlite, you either accept that 
there will be occasional lockouts or you use two databases.

One database, dedicated to the scheduler, will have its own set of locks, 
and the other database, holding the data being handled by the website, has 
its own set of locks.  A request won't interfere with the scheduler, and 
the scheduler won't interfere with requests (except when actually accessing 
the site's data).

The code sample (which I snipped) just shows you how to set up the 
connection strings for these two databases and to refer to the scheduler's 
database when telling the scheduler what to do.

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


Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Chetan Jain
while running this file, db is locked.
What to do in such case?

I find this answer:

if you can, use a separate db for the scheduler. SQLite doesn't handle well
concurrent writes (with default operational capabilities), so having the
scheduler operating on the same database of your "insertion" of messages
can lead to locks.

Just do

db = DAL('whatever.db')
db2 = DAL('whatever_scheduler.db')

db.define_table('messages', .)

from gluon.scheduler import Scheduler
mysched = Scheduler(db2)

and to queue tasks you can then use

db2.scheduler_tasks.validate_and_insert()

or, with the new API

mysched.queue_task(***)


i'm not clear with it

Best,
Chetan Jain

On Thu, Jul 14, 2016 at 12:51 AM, Chetan Jain  wrote:

> is this the correct command to run : python web2py.py -S social -M -X -R
> applications/social/private/sms_queue.py?
>
> Best,
> Chetan Jain
>
> On Thu, Jul 14, 2016 at 12:43 AM, Dave S  wrote:
>
>>
>>
>> On Wednesday, July 13, 2016 at 12:03:31 PM UTC-7, Chetan Jain wrote:
>>>
>>> Finally, as described in Chapter 4, we need to run the mail_queue.py
>>> script as if it were inside a controller in our app:
>>>
>>> 1
>>>
>>> python web2py.py -S app -M -N -R applications/app/private/mail_queue.py
>>>
>>> where -S app tells web2py to run "mail_queue.py" as "app", -M tells
>>> web2py to execute models, and -N tells web2py not to run cron.
>>>
>>> For background task :
>>> http://web2py.com/books/default/chapter/34/08/email-and-sms#Sending-messages-using-a-background-task
>>> .
>>>
>>> I was simply following the command given in this document.
>>>
>>>
>>>
>>> Best,
>>> Chetan Jain
>>>
>>>
>> Hmmm, that must be an obsolete option, and that reference got missed when
>> the option was removed.
>>
>> /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.
>>
>
>

-- 
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: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Chetan Jain
is this the correct command to run : python web2py.py -S social -M -X -R
applications/social/private/sms_queue.py?

Best,
Chetan Jain

On Thu, Jul 14, 2016 at 12:43 AM, Dave S  wrote:

>
>
> On Wednesday, July 13, 2016 at 12:03:31 PM UTC-7, Chetan Jain wrote:
>>
>> Finally, as described in Chapter 4, we need to run the mail_queue.py
>> script as if it were inside a controller in our app:
>>
>> 1
>>
>> python web2py.py -S app -M -N -R applications/app/private/mail_queue.py
>>
>> where -S app tells web2py to run "mail_queue.py" as "app", -M tells
>> web2py to execute models, and -N tells web2py not to run cron.
>>
>> For background task :
>> http://web2py.com/books/default/chapter/34/08/email-and-sms#Sending-messages-using-a-background-task
>> .
>>
>> I was simply following the command given in this document.
>>
>>
>>
>> Best,
>> Chetan Jain
>>
>>
> Hmmm, that must be an obsolete option, and that reference got missed when
> the option was removed.
>
> /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.
>

-- 
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: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Dave S


On Wednesday, July 13, 2016 at 12:03:31 PM UTC-7, Chetan Jain wrote:
>
> Finally, as described in Chapter 4, we need to run the mail_queue.py 
> script as if it were inside a controller in our app:
>
> 1
>
> python web2py.py -S app -M -N -R applications/app/private/mail_queue.py
>
> where -S app tells web2py to run "mail_queue.py" as "app", -M tells 
> web2py to execute models, and -N tells web2py not to run cron.
>
> For background task : 
> http://web2py.com/books/default/chapter/34/08/email-and-sms#Sending-messages-using-a-background-task
> .
>
> I was simply following the command given in this document.
>
>
>
> Best,
> Chetan Jain
>
>
Hmmm, that must be an obsolete option, and that reference got missed when 
the option was removed.

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


Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Chetan Jain
Finally, as described in Chapter 4, we need to run the mail_queue.py script
as if it were inside a controller in our app:

1

python web2py.py -S app -M -N -R applications/app/private/mail_queue.py

where -S app tells web2py to run "mail_queue.py" as "app", -M tells web2py
to execute models, and -N tells web2py not to run cron.

For background task :
http://web2py.com/books/default/chapter/34/08/email-and-sms#Sending-messages-using-a-background-task
.

I was simply following the command given in this document.



Best,
Chetan Jain

On Thu, Jul 14, 2016 at 12:29 AM, Dave S  wrote:

>
>
> On Wednesday, July 13, 2016 at 11:52:51 AM UTC-7, Chetan Jain wrote:
>>
>> python web2py.py -S social -M -N -R
>> applications/social/private/sms_queue.py
>> Usage: python web2py.py
>>
>> web2py.py: error: no such option: -N
>>
>>
> What are you expecting -N to do?
>
> The actual command line options are listed at
>  http://web2py.com/books/default/chapter/29/04/the-core#Command-line-options
> >
>
>
>> Best,
>> Chetan Jain
>>
>>
>
> /dps
>
>
>> On Wed, Jul 13, 2016 at 11:39 PM, Dave S  wrote:
>>
>>>
>>>
>>> On Wednesday, July 13, 2016 at 9:31:13 AM UTC-7, Chetan Jain wrote:

 Hi Anthony,


Scenario is : I've to send a 'status' SMS to a phone_number after
 every 30 minutes and Append its Status statement on a webpage, Since I have
 to send SMS after every 30 minutes, I have to call function after 30
 minutes each.

 This is what i'm trying to implement,
 I've already coded all function in python, i'm getting difficulties in
 web part only.



>>> use scheduler to launch long process, record PID of same.
>>> user scheduler to launch periodic checker, look for PID of long
>>> process.  Unqueue periodic checker when PID removed.
>>>
>>>
>>>

 Plus one more problem,

 i'm using request.now for getting date and time, however i'm getting
 same value.


 for i in range(5):
 print request.now
 time.sleep(5)
 pass


 output i'm getting is :

 2016-07-13 21:27:50.658693
 2016-07-13 21:27:50.658693
 2016-07-13 21:27:50.658693
 2016-07-13 21:27:50.658693
 2016-07-13 21:27:50.658693


 expected output is delay of 5 seconds each time.


>>> request.now is set at the time web2py begins processing the request.  It
>>> remains constant for the duration of the request.  If you need to find out
>>> the time after you've done some processing, use datetime.datetime.now.
>>>
>>> But do not sleep more than a little bit in a request ... the front end
>>> will timeout the thread you're in.
>>>
>>>
>>>
>>>
 Best,
 Chetan Jain


>>> /dps
>>>
>>>
>>>
 On Wed, Jul 13, 2016 at 12:04 AM, Anthony  wrote:

> On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro
> wrote:
>>
>> forget load in this case.
>>
>> 
>> 
>>
>> 
>> var counter = 0;
>> var minutes = 2;
>> var max_calls = 10;
>> var url = "{{=URL('call')}}";
>> var f = function() {
>> counter = counter + 1;
>> jQuery.get(url).done(function(data) {
>>jQuery('#target').html(data);
>>if(counter>   setTimeout(f, minutes*60*1000);
>> });
>> }
>> f();
>> 
>>
>
> How is the above different from:
>
> {{=LOAD('call', ajax=True, timeout=2*60, times=10)}}
>
> Anthony
>
>
>>
>> On Tuesday, 12 July 2016 08:47:44 UTC-5, Chetan Jain wrote:
>>
>>> URL : https://pqr.pythonanywhere.com/ajax/default/index
>>>
>>> Best,
>>> Chetan Jain
>>>
>>> On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro <
>>> massimo@gmail.com> wrote:
>>>
 It is not clear. Where is your app?


 On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote:
>
> Hi Anthony,
>
>   i've created one 24 hours web2py application at
> pythonanywhere.com, please let me know when you have 10-15
> minutes of time, so that i can rectify my problem.
>   Thanks in advance.
>
>
>
>
> On Tue, Jul 12, 2016 at 7:43 AM, Anthony 
> wrote:
>
>> If your view includes an {{=i}} variable, then your function must
>> return a dictionary with "i" as one of its keys. Hard to say what's 
>> wrong
>> without seeing the current version of this function.
>
>
>
>
> Best,
> Chetan Jain
>
 --
 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)
 ---

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Dave S


On Wednesday, July 13, 2016 at 11:52:51 AM UTC-7, Chetan Jain wrote:
>
> python web2py.py -S social -M -N -R 
> applications/social/private/sms_queue.py
> Usage: python web2py.py
>
> web2py.py: error: no such option: -N
>
>
What are you expecting -N to do?
 
The actual command line options are listed at



> Best,
> Chetan Jain
>
>

/dps
 

> On Wed, Jul 13, 2016 at 11:39 PM, Dave S  > wrote:
>
>>
>>
>> On Wednesday, July 13, 2016 at 9:31:13 AM UTC-7, Chetan Jain wrote:
>>>
>>> Hi Anthony, 
>>>
>>>
>>>Scenario is : I've to send a 'status' SMS to a phone_number after 
>>> every 30 minutes and Append its Status statement on a webpage, Since I have 
>>> to send SMS after every 30 minutes, I have to call function after 30 
>>> minutes each.
>>>
>>> This is what i'm trying to implement, 
>>> I've already coded all function in python, i'm getting difficulties in 
>>> web part only.
>>>
>>>
>>>
>> use scheduler to launch long process, record PID of same.
>> user scheduler to launch periodic checker, look for PID of long process.  
>> Unqueue periodic checker when PID removed.
>>
>>  
>>
>>>
>>> Plus one more problem,
>>>
>>> i'm using request.now for getting date and time, however i'm getting 
>>> same value.
>>>
>>>
>>> for i in range(5):
>>> print request.now
>>> time.sleep(5)
>>> pass
>>>
>>>
>>> output i'm getting is :
>>>
>>> 2016-07-13 21:27:50.658693
>>> 2016-07-13 21:27:50.658693
>>> 2016-07-13 21:27:50.658693
>>> 2016-07-13 21:27:50.658693
>>> 2016-07-13 21:27:50.658693
>>>
>>>
>>> expected output is delay of 5 seconds each time.
>>>
>>>
>> request.now is set at the time web2py begins processing the request.  It 
>> remains constant for the duration of the request.  If you need to find out 
>> the time after you've done some processing, use datetime.datetime.now.
>>
>> But do not sleep more than a little bit in a request ... the front end 
>> will timeout the thread you're in.
>>
>>
>>  
>>
>>> Best,
>>> Chetan Jain
>>>
>>>
>> /dps
>>
>>  
>>
>>> On Wed, Jul 13, 2016 at 12:04 AM, Anthony  wrote:
>>>
 On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro wrote:
>
> forget load in this case.
>
> 
> 
>
> 
> var counter = 0;
> var minutes = 2;
> var max_calls = 10;
> var url = "{{=URL('call')}}";
> var f = function() {
> counter = counter + 1;
> jQuery.get(url).done(function(data) {
>jQuery('#target').html(data);   
>if(counter   setTimeout(f, minutes*60*1000);
> });   
> }   
> f();
> 
>

 How is the above different from:

 {{=LOAD('call', ajax=True, timeout=2*60, times=10)}}

 Anthony
  

>
> On Tuesday, 12 July 2016 08:47:44 UTC-5, Chetan Jain wrote:
>
>> URL : https://pqr.pythonanywhere.com/ajax/default/index
>>
>> Best,
>> Chetan Jain
>>
>> On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro <
>> massimo@gmail.com> wrote:
>>
>>> It is not clear. Where is your app?
>>>
>>>
>>> On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote:

 Hi Anthony,

   i've created one 24 hours web2py application at 
 pythonanywhere.com, please let me know when you have 10-15 minutes 
 of time, so that i can rectify my problem.
   Thanks in advance.




 On Tue, Jul 12, 2016 at 7:43 AM, Anthony  wrote:

> If your view includes an {{=i}} variable, then your function must 
> return a dictionary with "i" as one of its keys. Hard to say what's 
> wrong 
> without seeing the current version of this function.




 Best,
 Chetan Jain

>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, 
>>> send an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to 

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Chetan Jain
python web2py.py -S social -M -N -R applications/social/private/sms_queue.py
Usage: python web2py.py

web2py.py: error: no such option: -N


Best,
Chetan Jain

On Wed, Jul 13, 2016 at 11:39 PM, Dave S  wrote:

>
>
> On Wednesday, July 13, 2016 at 9:31:13 AM UTC-7, Chetan Jain wrote:
>>
>> Hi Anthony,
>>
>>
>>Scenario is : I've to send a 'status' SMS to a phone_number after
>> every 30 minutes and Append its Status statement on a webpage, Since I have
>> to send SMS after every 30 minutes, I have to call function after 30
>> minutes each.
>>
>> This is what i'm trying to implement,
>> I've already coded all function in python, i'm getting difficulties in
>> web part only.
>>
>>
>>
> use scheduler to launch long process, record PID of same.
> user scheduler to launch periodic checker, look for PID of long process.
> Unqueue periodic checker when PID removed.
>
>
>
>>
>> Plus one more problem,
>>
>> i'm using request.now for getting date and time, however i'm getting same
>> value.
>>
>>
>> for i in range(5):
>> print request.now
>> time.sleep(5)
>> pass
>>
>>
>> output i'm getting is :
>>
>> 2016-07-13 21:27:50.658693
>> 2016-07-13 21:27:50.658693
>> 2016-07-13 21:27:50.658693
>> 2016-07-13 21:27:50.658693
>> 2016-07-13 21:27:50.658693
>>
>>
>> expected output is delay of 5 seconds each time.
>>
>>
> request.now is set at the time web2py begins processing the request.  It
> remains constant for the duration of the request.  If you need to find out
> the time after you've done some processing, use datetime.datetime.now.
>
> But do not sleep more than a little bit in a request ... the front end
> will timeout the thread you're in.
>
>
>
>
>> Best,
>> Chetan Jain
>>
>>
> /dps
>
>
>
>> On Wed, Jul 13, 2016 at 12:04 AM, Anthony  wrote:
>>
>>> On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro wrote:

 forget load in this case.

 
 

 
 var counter = 0;
 var minutes = 2;
 var max_calls = 10;
 var url = "{{=URL('call')}}";
 var f = function() {
 counter = counter + 1;
 jQuery.get(url).done(function(data) {
jQuery('#target').html(data);
if(counter>>
>>> How is the above different from:
>>>
>>> {{=LOAD('call', ajax=True, timeout=2*60, times=10)}}
>>>
>>> Anthony
>>>
>>>

 On Tuesday, 12 July 2016 08:47:44 UTC-5, Chetan Jain wrote:

> URL : https://pqr.pythonanywhere.com/ajax/default/index
>
> Best,
> Chetan Jain
>
> On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro <
> massimo@gmail.com> wrote:
>
>> It is not clear. Where is your app?
>>
>>
>> On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote:
>>>
>>> Hi Anthony,
>>>
>>>   i've created one 24 hours web2py application at pythonanywhere.com,
>>> please let me know when you have 10-15 minutes of time, so that i can
>>> rectify my problem.
>>>   Thanks in advance.
>>>
>>>
>>>
>>>
>>> On Tue, Jul 12, 2016 at 7:43 AM, Anthony  wrote:
>>>
 If your view includes an {{=i}} variable, then your function must
 return a dictionary with "i" as one of its keys. Hard to say what's 
 wrong
 without seeing the current version of this function.
>>>
>>>
>>>
>>>
>>> Best,
>>> Chetan Jain
>>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google
>> Groups "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to web2py+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Dave S


On Wednesday, July 13, 2016 at 9:31:13 AM UTC-7, Chetan Jain wrote:
>
> Hi Anthony, 
>
>
>Scenario is : I've to send a 'status' SMS to a phone_number after every 
> 30 minutes and Append its Status statement on a webpage, Since I have to 
> send SMS after every 30 minutes, I have to call function after 30 minutes 
> each.
>
> This is what i'm trying to implement, 
> I've already coded all function in python, i'm getting difficulties in web 
> part only.
>
>
>
use scheduler to launch long process, record PID of same.
user scheduler to launch periodic checker, look for PID of long process.  
Unqueue periodic checker when PID removed.

 

>
> Plus one more problem,
>
> i'm using request.now for getting date and time, however i'm getting same 
> value.
>
>
> for i in range(5):
> print request.now
> time.sleep(5)
> pass
>
>
> output i'm getting is :
>
> 2016-07-13 21:27:50.658693
> 2016-07-13 21:27:50.658693
> 2016-07-13 21:27:50.658693
> 2016-07-13 21:27:50.658693
> 2016-07-13 21:27:50.658693
>
>
> expected output is delay of 5 seconds each time.
>
>
request.now is set at the time web2py begins processing the request.  It 
remains constant for the duration of the request.  If you need to find out 
the time after you've done some processing, use datetime.datetime.now.

But do not sleep more than a little bit in a request ... the front end will 
timeout the thread you're in.


 

> Best,
> Chetan Jain
>
>
/dps

 

> On Wed, Jul 13, 2016 at 12:04 AM, Anthony  > wrote:
>
>> On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro wrote:
>>>
>>> forget load in this case.
>>>
>>> 
>>> 
>>>
>>> 
>>> var counter = 0;
>>> var minutes = 2;
>>> var max_calls = 10;
>>> var url = "{{=URL('call')}}";
>>> var f = function() {
>>> counter = counter + 1;
>>> jQuery.get(url).done(function(data) {
>>>jQuery('#target').html(data);   
>>>if(counter>>   setTimeout(f, minutes*60*1000);
>>> });   
>>> }   
>>> f();
>>> 
>>>
>>
>> How is the above different from:
>>
>> {{=LOAD('call', ajax=True, timeout=2*60, times=10)}}
>>
>> Anthony
>>  
>>
>>>
>>> On Tuesday, 12 July 2016 08:47:44 UTC-5, Chetan Jain wrote:

 URL : https://pqr.pythonanywhere.com/ajax/default/index

 Best,
 Chetan Jain

 On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro <
 massimo@gmail.com > wrote:

> It is not clear. Where is your app?
>
>
> On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote:
>>
>> Hi Anthony,
>>
>>   i've created one 24 hours web2py application at pythonanywhere.com, 
>> please let me know when you have 10-15 minutes of time, so that i can 
>> rectify my problem.
>>   Thanks in advance.
>>
>>
>>
>>
>> On Tue, Jul 12, 2016 at 7:43 AM, Anthony > > wrote:
>>
>>> If your view includes an {{=i}} variable, then your function must 
>>> return a dictionary with "i" as one of its keys. Hard to say what's 
>>> wrong 
>>> without seeing the current version of this function.
>>
>>
>>
>>
>> Best,
>> Chetan Jain
>>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>

 -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Nginx & The Welcome App

2016-07-13 Thread Dave S


On Wednesday, July 13, 2016 at 5:48:21 AM UTC-7, Mark Billion wrote:
>
> Nginx redirects my users from the website to the 
> website/welcome/indexmy app is t4.  Ive tried to configure the Web2py 
> sites enabled to fix it, but it fails.  Here is the w2p sites enabled 
> fileany thoughts would be much appreciated.
>
>
As a very unspecific answer, the welcome app is the default app in the 
out-of-the-box configuration.  This is normally changed in routes.py, I 
believe.

Are your nginx rules passing the application name through to web2py

//http:mysite/myapp/mycontroller/myfunction?myargumentiveness
  ^ this part

/dps


 

>
> server {
> listen  80;
> server_name $hostname;
> ###to enable correct use of response.static_version
> #location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
> #alias /home/www-data/web2py/applications/$1/static/$2;
> #expires max;
> #}
> ###
>
> ###if you use something like myapp = dict(languages=[en, it, jp], 
> default_language=en) in your routes.py
> #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
> #alias /home/www-data/web2py/applications/$1/;
> #try_files static/$2/$3 static/$3 =404;
> #}
> ###
> location ~* ^/(\w+)/static/ {
> root /home/www-data/web2py/applications/t4;
> #remove next comment on production
> #expires max;
> ### if you want to use pre-gzipped static files (recommended)
> ### check scripts/zip_static_files.py and remove the comments
> # include /etc/nginx/conf.d/web2py/gzip_static.conf;
> ###
> }
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>
> ###remove the comments to turn on if you want gzip compression 
> of your pages
> # include /etc/nginx/conf.d/web2py/gzip.conf;
> ### end gzip section
>
> ### remove the comments if you use uploads (max 10 MB)
> #client_max_body_size 10m;
> ###
> }
> }
> server {
> listen 443 default_server ssl;
> server_name $hostname;
> ssl_certificate /etc/nginx/ssl/web2py.crt;
> ssl_certificate_key /etc/nginx/ssl/web2py.key;
> ssl_prefer_server_ciphers on;
> ssl_session_cache shared:SSL:10m;
> ssl_session_timeout 10m;
> ssl_ciphers 
> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
> ssl_protocols SSLv3 TLSv1;
> keepalive_timeout70;
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> ###remove the comments to turn on if you want gzip compression 
> of your pages
> # include /etc/nginx/conf.d/web2py/gzip.conf;
> ### end gzip section
> ### remove the comments if you want to enable uploads (max 10 
> MB)
> #client_max_body_size 10m;
> ###
> }
> ## if you serve static files through https, copy here the section
> ## from the previous server instance to manage static files
>
> }
>

-- 
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: onvalidation error for nonSQLFORM but request.vars

2016-07-13 Thread lucas
so what do you think?  couldn't code be added to allow for the search and 
DIV(red error box) on the final html form/DOM regardless of if the field 
exists in the original SQLFORM?

-- 
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: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-13 Thread Chetan Jain
Hi Anthony,


   Scenario is : I've to send a 'status' SMS to a phone_number after every
30 minutes and Append its Status statement on a webpage, Since I have to
send SMS after every 30 minutes, I have to call function after 30 minutes
each.

This is what i'm trying to implement,
I've already coded all function in python, i'm getting difficulties in web
part only.



Plus one more problem,

i'm using request.now for getting date and time, however i'm getting same
value.


for i in range(5):
print request.now
time.sleep(5)
pass


output i'm getting is :

2016-07-13 21:27:50.658693
2016-07-13 21:27:50.658693
2016-07-13 21:27:50.658693
2016-07-13 21:27:50.658693
2016-07-13 21:27:50.658693


expected output is delay of 5 seconds each time.

Best,
Chetan Jain

On Wed, Jul 13, 2016 at 12:04 AM, Anthony  wrote:

> On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro wrote:
>>
>> forget load in this case.
>>
>> 
>> 
>>
>> 
>> var counter = 0;
>> var minutes = 2;
>> var max_calls = 10;
>> var url = "{{=URL('call')}}";
>> var f = function() {
>> counter = counter + 1;
>> jQuery.get(url).done(function(data) {
>>jQuery('#target').html(data);
>>if(counter>   setTimeout(f, minutes*60*1000);
>> });
>> }
>> f();
>> 
>>
>
> How is the above different from:
>
> {{=LOAD('call', ajax=True, timeout=2*60, times=10)}}
>
> Anthony
>
>
>>
>> On Tuesday, 12 July 2016 08:47:44 UTC-5, Chetan Jain wrote:
>>>
>>> URL : https://pqr.pythonanywhere.com/ajax/default/index
>>>
>>> Best,
>>> Chetan Jain
>>>
>>> On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro <
>>> massimo.dipie...@gmail.com> wrote:
>>>
 It is not clear. Where is your app?


 On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote:
>
> Hi Anthony,
>
>   i've created one 24 hours web2py application at pythonanywhere.com,
> please let me know when you have 10-15 minutes of time, so that i can
> rectify my problem.
>   Thanks in advance.
>
>
>
>
> On Tue, Jul 12, 2016 at 7:43 AM, Anthony  wrote:
>
>> If your view includes an {{=i}} variable, then your function must
>> return a dictionary with "i" as one of its keys. Hard to say what's wrong
>> without seeing the current version of this function.
>
>
>
>
> Best,
> Chetan Jain
>
 --
 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.
>

-- 
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: Nginx & The Welcome App

2016-07-13 Thread pbreit
Yeah, I think either need to rename your app directory "init" or add a 
routes.py file in your web2py directory with:

routers = dict(
  BASE  = dict(default_application='myapp'),)

-- 
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: Nginx & The Welcome App

2016-07-13 Thread Antonio Salazar
Have you changed your default application?
http://web2py.com/books/default/chapter/29/04/the-core#Application-init

On Wednesday, July 13, 2016 at 7:48:21 AM UTC-5, Mark Billion wrote:
>
> Nginx redirects my users from the website to the 
> website/welcome/indexmy app is t4.  Ive tried to configure the Web2py 
> sites enabled to fix it, but it fails.  Here is the w2p sites enabled 
> fileany thoughts would be much appreciated.
>
>
> server {
> listen  80;
> server_name $hostname;
> ###to enable correct use of response.static_version
> #location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
> #alias /home/www-data/web2py/applications/$1/static/$2;
> #expires max;
> #}
> ###
>
> ###if you use something like myapp = dict(languages=[en, it, jp], 
> default_language=en) in your routes.py
> #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
> #alias /home/www-data/web2py/applications/$1/;
> #try_files static/$2/$3 static/$3 =404;
> #}
> ###
> location ~* ^/(\w+)/static/ {
> root /home/www-data/web2py/applications/t4;
> #remove next comment on production
> #expires max;
> ### if you want to use pre-gzipped static files (recommended)
> ### check scripts/zip_static_files.py and remove the comments
> # include /etc/nginx/conf.d/web2py/gzip_static.conf;
> ###
> }
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>
> ###remove the comments to turn on if you want gzip compression 
> of your pages
> # include /etc/nginx/conf.d/web2py/gzip.conf;
> ### end gzip section
>
> ### remove the comments if you use uploads (max 10 MB)
> #client_max_body_size 10m;
> ###
> }
> }
> server {
> listen 443 default_server ssl;
> server_name $hostname;
> ssl_certificate /etc/nginx/ssl/web2py.crt;
> ssl_certificate_key /etc/nginx/ssl/web2py.key;
> ssl_prefer_server_ciphers on;
> ssl_session_cache shared:SSL:10m;
> ssl_session_timeout 10m;
> ssl_ciphers 
> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
> ssl_protocols SSLv3 TLSv1;
> keepalive_timeout70;
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> ###remove the comments to turn on if you want gzip compression 
> of your pages
> # include /etc/nginx/conf.d/web2py/gzip.conf;
> ### end gzip section
> ### remove the comments if you want to enable uploads (max 10 
> MB)
> #client_max_body_size 10m;
> ###
> }
> ## if you serve static files through https, copy here the section
> ## from the previous server instance to manage static files
>
> }
>

-- 
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: Angularjs calls to web2py rest api

2016-07-13 Thread botasservice
I've tried this type of view (default/index.html):






[[ myData.id ]]



var app = angular.module('myApp', []);
app.controller('testCtrl',function($scope,$http){
$http.get("http://127.0.0.1:8000/api/test/10";).then(function(response){
$scope.myData = response.data.row
});
});



But i'm getting just [[ myData.id ]] in my browser.

The output when I'm calling http://127.0.0.1:8000/api/test/10 with browser 
is:
{"row": {"test": "my test string", "id": 10}}

changes on angular.js in function $InterpolateProvider():
var startSymbol = '[[';
var endSymbol = ']]';


-- 
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: Nginx & The Welcome App

2016-07-13 Thread Jim S
So, it's getting to your web2py site and displaying the welcome app instead 
of yours, right?

If that is the case, then what does your routes.py look like?  I use 
routes.py to direct traffic to the correct application.

-Jim

On Wednesday, July 13, 2016 at 7:48:21 AM UTC-5, Mark Billion wrote:
>
> Nginx redirects my users from the website to the 
> website/welcome/indexmy app is t4.  Ive tried to configure the Web2py 
> sites enabled to fix it, but it fails.  Here is the w2p sites enabled 
> fileany thoughts would be much appreciated.
>
>
> server {
> listen  80;
> server_name $hostname;
> ###to enable correct use of response.static_version
> #location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
> #alias /home/www-data/web2py/applications/$1/static/$2;
> #expires max;
> #}
> ###
>
> ###if you use something like myapp = dict(languages=[en, it, jp], 
> default_language=en) in your routes.py
> #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
> #alias /home/www-data/web2py/applications/$1/;
> #try_files static/$2/$3 static/$3 =404;
> #}
> ###
> location ~* ^/(\w+)/static/ {
> root /home/www-data/web2py/applications/t4;
> #remove next comment on production
> #expires max;
> ### if you want to use pre-gzipped static files (recommended)
> ### check scripts/zip_static_files.py and remove the comments
> # include /etc/nginx/conf.d/web2py/gzip_static.conf;
> ###
> }
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>
> ###remove the comments to turn on if you want gzip compression 
> of your pages
> # include /etc/nginx/conf.d/web2py/gzip.conf;
> ### end gzip section
>
> ### remove the comments if you use uploads (max 10 MB)
> #client_max_body_size 10m;
> ###
> }
> }
> server {
> listen 443 default_server ssl;
> server_name $hostname;
> ssl_certificate /etc/nginx/ssl/web2py.crt;
> ssl_certificate_key /etc/nginx/ssl/web2py.key;
> ssl_prefer_server_ciphers on;
> ssl_session_cache shared:SSL:10m;
> ssl_session_timeout 10m;
> ssl_ciphers 
> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
> ssl_protocols SSLv3 TLSv1;
> keepalive_timeout70;
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> ###remove the comments to turn on if you want gzip compression 
> of your pages
> # include /etc/nginx/conf.d/web2py/gzip.conf;
> ### end gzip section
> ### remove the comments if you want to enable uploads (max 10 
> MB)
> #client_max_body_size 10m;
> ###
> }
> ## if you serve static files through https, copy here the section
> ## from the previous server instance to manage static files
>
> }
>

-- 
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: creating an accessible file with public access

2016-07-13 Thread Aydin
OK, I could read the file. The permission of it was OK; it was that I had a 
typo in my url. if someone wants to change the permission of a file os.chmod 
can do it.
I'm gonna go with the external sharing of the databases tho.


On Tuesday, July 12, 2016 at 4:03:53 PM UTC-4, Aydin wrote:
>
> I'm using browser to access it. But it returns invalid. It's interesting 
> because I have other files in static folder and they can be accessed such 
> as 
> Web2py.css.
> I'm starting to think that maybe when I create the file, it does not give 
> it permission to read by default. I will check that later. But if that's 
> the case, then I don't know how to fix it.
> That's teally great that I can share the databases externally. I will try 
> that next 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.


[web2py] Nginx & The Welcome App

2016-07-13 Thread Mark Billion
Nginx redirects my users from the website to the 
website/welcome/indexmy app is t4.  Ive tried to configure the Web2py 
sites enabled to fix it, but it fails.  Here is the w2p sites enabled 
fileany thoughts would be much appreciated.


server {
listen  80;
server_name $hostname;
###to enable correct use of response.static_version
#location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
#alias /home/www-data/web2py/applications/$1/static/$2;
#expires max;
#}
###

###if you use something like myapp = dict(languages=[en, it, jp], 
default_language=en) in your routes.py
#location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
#alias /home/www-data/web2py/applications/$1/;
#try_files static/$2/$3 static/$3 =404;
#}
###
location ~* ^/(\w+)/static/ {
root /home/www-data/web2py/applications/t4;
#remove next comment on production
#expires max;
### if you want to use pre-gzipped static files (recommended)
### check scripts/zip_static_files.py and remove the comments
# include /etc/nginx/conf.d/web2py/gzip_static.conf;
###
}
location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

###remove the comments to turn on if you want gzip compression 
of your pages
# include /etc/nginx/conf.d/web2py/gzip.conf;
### end gzip section

### remove the comments if you use uploads (max 10 MB)
#client_max_body_size 10m;
###
}
}
server {
listen 443 default_server ssl;
server_name $hostname;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers 
ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols SSLv3 TLSv1;
keepalive_timeout70;
location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
###remove the comments to turn on if you want gzip compression 
of your pages
# include /etc/nginx/conf.d/web2py/gzip.conf;
### end gzip section
### remove the comments if you want to enable uploads (max 10 
MB)
#client_max_body_size 10m;
###
}
## if you serve static files through https, copy here the section
## from the previous server instance to manage static files

}

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to implement token based restful api in web2py

2016-07-13 Thread botasservice
Massimo, i've downloaded your example with APIMaker and getting error:

 json() got an unexpected keyword argument 
'indent'

File "applications\collection2\modules\apimaker.py", line 294, in process
return response.json(res, indent=2)+'\n'

вторник, 12 июля 2016 г., 11:39:18 UTC+3 пользователь Massimo Di Pierro 
написал:
>
> TW. The name is going to change today. DBAPI will be renamed something 
> else.
>
> On Monday, 11 July 2016 07:43:13 UTC-5, Marlysson Silva wrote:
>>
>> Without to use DBAPI but still it would be possible to build API Rest 
>> with web2py using @restful?
>>
>> Managering dal mannualy
>>
>> Em segunda-feira, 11 de julho de 2016 09:38:36 UTC-3, Massimo Di Pierro 
>> escreveu:
>>>
>>> This is what the manual has to say about it:
>>>
>>> 
>>> http://web2py.com/books/default/chapter/29/10/services?search=restful#Restful-Web-Services
>>>
>>> If you are willing to try something more beading edge:
>>>
>>> http://experts4solutions.com/collection2/default/examples
>>>
>>> The latter is experimental, requires both web2py and pydal trunk, and we 
>>> cannot yet promise backward compatibility.
>>>
>>> Massimo
>>>
>>> On Monday, 11 July 2016 01:11:38 UTC-5, Rakesh Sinha wrote:

 Hi All,
 I am very new to web2py. I need to create some token based REST APIs 
 which will be consumed by other web application (Also written in web2py).
 How do we do that in web2py? I have used djanfo REST Framework, is 
 there anything similar in web2py? Please help. Thaks 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.