Re: [web2py] keyError

2015-10-04 Thread Alex Glaros
am having hard time finding syntax for checking for empty API data in above 
example

tried many variations of:

{{if location_data:}}

any ideas? 

thanks,

Alex

-- 
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] Markmin best practices

2015-10-04 Thread St. Pirsch
I have some noob questions on how to use Markmin correctly: 
Is there a way to link pictures within markmin, i.e. to produce  ?
I noticed that anchors get the prefix "markmin-" automatically. I guess 
there is a concept behind this decision, but I do not see the reason & is 
there a way to circumvent this behaviour?
Maybe there is a more in depth documentation beyond 
http://web2py.googlecode.com/hg/applications/examples/static/markmin.html 
with more info on how to apply custom styles and other modifications? 
Thanks -Stephan

-- 
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] Static content seems to load with a 404 error... uwsgi nginx

2015-10-04 Thread Encompass solutions
I have setup uwsgi and I seem to be very close to having everything working.
It just seems that my static data is not loaded now. (css, images, so forth)
This is my nginx file with the web2py applicaiton in it.
Any ideas into the issue?  My web2py installation is located in 
/var/www/web2py/.
# file /etc/nginx/sites-available/web2py
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;
#}
location ~* /(\w+)/static/ {
root /home/www-data/web2py/applications/;
#remove next comment on production
#expires max;
}
location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///tmp/web2py.sock;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}
}
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.sock;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}

}



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


[web2py] Re: Has anyone done a detailed security analysis or attempted a methodical attack on web2py?

2015-10-04 Thread Ian Ryder
Hi, just looking back over anything about penetration testing and web2py - 
does anyone know of any recent (or any at all) testing of web2py? We're 
getting close to our first customers on an app we've been developing the 
last year so really need to try and pick it to pieces now while we have a 
few months to work on anything we need to.

Thanks
Ian

On Tuesday, 10 July 2012 19:42:46 UTC+2, Massimo Di Pierro wrote:
>
> Thank you Dave for the feedback. It would be nice to have the results of 
> those  tests (Cenznic, Hailstorm, Quails) published somewhere. Once in a 
> while people ask about this.
>
> Massimo
>
> On Tuesday, 10 July 2012 11:28:39 UTC-5, Dave wrote:
>>
>> Well
>>
>> I can't say that I have tested the current trunk version, but last 
>> December I ran a pretty exhaustive penetration test against a site 
>> developed web2py.  The results were very good.  No findings above low.  The 
>> low findings were insignificant.  I ran Cenzic Hailstorm, Qualys and one 
>> other automated vulnerability test suite (I cant remember which at the 
>> moment) against it without issue.  
>>
>> Here are some things that can cause issue though...
>>
>> * anywhere you use the XML() method in a view you should make sure you 
>> have validation turned on.  Even though the framework is resilient and does 
>> a good job of sanitizing data in & out, you can still end up in XSS or XSRF 
>> trouble with XML().
>>
>> * redirects can trip up or slow down a lot of vuln scanners.  Watch out 
>> if you perform your own testing that you're not getting false negatives.
>>
>> I know some people that would take on a more "formal" assessment if there 
>> is consensus
>>
>> Dave
>>
>> On Monday, July 9, 2012 11:48:39 AM UTC-4, scausten wrote:
>>>
>>> One of the awesome things about web2py is of course the built-in and 
>>> well-documented resilience against a range of attack methods, but I was 
>>> wondering if anyone has attempted a methodical (white-hat) attack to probe 
>>> any potential weaknesses?
>>>
>>> Just out of interest :)
>>>
>>

-- 
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: Web2py celery plugin

2015-10-04 Thread Luis Valladares
Hello mark! thanks for you answer.

Your approach sounds really nice, but exactly how you run a cron task 
inside web2py environment? you start the web2py client with the console 
option and there execute the task? may you give me an example of this?

El domingo, 4 de octubre de 2015, 8:31:20 (UTC-4:30), Mark Graves escribió:
>
> Luis,
>
> I've never personally used celery to queue tasks to execute in a web2py 
> environment.
>
> I found myself in a similar situation recently and just used a cron task 
> running a python script in the web2py environment from the command line.
>
> Is there a particular reason this workflow would not work for you?
>
> -Mark
>
> On Saturday, October 3, 2015 at 10:40:47 AM UTC-5, Luis Valladares wrote:
>>
>> But how can you exec a web2py task (who may uses web2py internal 
>> components like Request, response, db, etc..) with a external celery app? i 
>> mean, if i wish to execute a task, for example: To insert a new register in 
>> a table of my web2py database, and in enqueue this task to a remote (or 
>> local) celery worker to do it, how i can get this worker to know about all 
>> the "environment" of web2py? the only idea i have its creating a worker 
>> that is aware of the web2py environment, but i dont know how to do this.
>>
>> There is anyway to use celery queue to execute tasks that requires the 
>> web2py environment?
>>
>> El viernes, 2 de octubre de 2015, 5:46:35 (UTC-4:30), Niphlod escribió:
>>>
>>> I'd say you're loosing yourself in a glass of water. In order to 
>>> schedule something, that something must work. If your "something" doesn't, 
>>> it really doesn't matter what tool are you issuing commands to.
>>>
>>> On Friday, October 2, 2015 at 11:56:55 AM UTC+2, Stefan van den Eertwegh 
>>> wrote:

 Hi Niphlod,

 Thanks for you answer.

 Why i am asking this is because i want to generate around 150 pdf's by 
 weasyprint and per each pdf i want to queue a mail with it as an 
 attachment.
 Could this be done by the build in web2py Scheduler?

 PS: i tried the scheduler, but it tries to use the generic.html view 
 but has not enough settings provided in the layout.html to use it, it 
 fails.
 is is not so that it executes the function from the model with database 
 privileges and not uses a view? Or is it also using the default generic 
 view?

 Thanks for responding!

 Best regards,
 Stefan

 Op vrijdag 2 oktober 2015 11:21:07 UTC+2 schreef Niphlod:
>
> you won't ever get to start workers from web2py, either with the 
> embedded scheduler, with rq or with celery.that's pretty much a 
> requirement (being completely separated)
>
> PS: celery integration was done on a so old release of celery that it 
> won't ever be production ready
>
> PS2: you don't need any web2py plugin to push task to celery.
>
>
>

-- 
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: Web2py celery plugin

2015-10-04 Thread Mark Graves
Luis,

I've never personally used celery to queue tasks to execute in a web2py 
environment.

I found myself in a similar situation recently and just used a cron task 
running a python script in the web2py environment from the command line.

Is there a particular reason this workflow would not work for you?

-Mark

On Saturday, October 3, 2015 at 10:40:47 AM UTC-5, Luis Valladares wrote:
>
> But how can you exec a web2py task (who may uses web2py internal 
> components like Request, response, db, etc..) with a external celery app? i 
> mean, if i wish to execute a task, for example: To insert a new register in 
> a table of my web2py database, and in enqueue this task to a remote (or 
> local) celery worker to do it, how i can get this worker to know about all 
> the "environment" of web2py? the only idea i have its creating a worker 
> that is aware of the web2py environment, but i dont know how to do this.
>
> There is anyway to use celery queue to execute tasks that requires the 
> web2py environment?
>
> El viernes, 2 de octubre de 2015, 5:46:35 (UTC-4:30), Niphlod escribió:
>>
>> I'd say you're loosing yourself in a glass of water. In order to schedule 
>> something, that something must work. If your "something" doesn't, it really 
>> doesn't matter what tool are you issuing commands to.
>>
>> On Friday, October 2, 2015 at 11:56:55 AM UTC+2, Stefan van den Eertwegh 
>> wrote:
>>>
>>> Hi Niphlod,
>>>
>>> Thanks for you answer.
>>>
>>> Why i am asking this is because i want to generate around 150 pdf's by 
>>> weasyprint and per each pdf i want to queue a mail with it as an attachment.
>>> Could this be done by the build in web2py Scheduler?
>>>
>>> PS: i tried the scheduler, but it tries to use the generic.html view but 
>>> has not enough settings provided in the layout.html to use it, it fails.
>>> is is not so that it executes the function from the model with database 
>>> privileges and not uses a view? Or is it also using the default generic 
>>> view?
>>>
>>> Thanks for responding!
>>>
>>> Best regards,
>>> Stefan
>>>
>>> Op vrijdag 2 oktober 2015 11:21:07 UTC+2 schreef Niphlod:

 you won't ever get to start workers from web2py, either with the 
 embedded scheduler, with rq or with celery.that's pretty much a 
 requirement (being completely separated)

 PS: celery integration was done on a so old release of celery that it 
 won't ever be production ready

 PS2: you don't need any web2py plugin to push task to celery.




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

2015-10-04 Thread Alex Glaros
It works Denes, thanks.

Here is the version needed for my app

 {{cc=[]}}
{{for x in location_data['postalcodes']:}}
{{c=x['countryCode']}}
{{if c not in cc:}}
{{cc.append(c)}}
  
  {{countryName=db(db.Country.countryCode==c).select(limitby=(0,1)).first()}}
{{=A(countryName.countryName, 
_href=URL('default','select_city_from_postal_code', 
vars=dict(vars=request.vars, specificCountryID = countryName.id, 
your_postal_code=your_postal_code)))}}
{{pass}}
{{pass}}

Much appreciated. Sure beats downloading 43,000 postal codes,

Alex

-- 
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: Web2py celery plugin

2015-10-04 Thread Mark Graves
As documented in the web2py book,

The "web2py.py" script can take many command-line arguments specifying the
maximum number of threads, enabling of SSL, etc. For a complete list type:

>>> python web2py.py -h

For example, a shell script called async_events.sh can be called at
reboot as follows:

#! /bin/bash

cd /home/www-data/web2py

python web2py.py -S YOUR_APPLICATION_NAME -M -R
applications/YOUR_APPLICATION_NAME/private/async_events.py


The contents of async_events.py are a simple python script run as if it
were a request from web2py

For example:

import time



def create_pdfs(db):
> while True:
> ALL YOUR PDF PROCESSING LOGIC HERE

time.sleep(60)

>



create_pdfs(db)



The above is an example script where your create_pdfs function handles all
the processing logic.

The time.sleep(60) means run every minute.

You would run this task once @reboot so python would handle the interval
between tasks.

>From there, you can use all the internal web2py API including mail.send()
etc


-Mark



On Sun, Oct 4, 2015 at 8:16 AM, Luis Valladares 
wrote:

> Hello mark! thanks for you answer.
>
> Your approach sounds really nice, but exactly how you run a cron task
> inside web2py environment? you start the web2py client with the console
> option and there execute the task? may you give me an example of this?
>
>
> El domingo, 4 de octubre de 2015, 8:31:20 (UTC-4:30), Mark Graves escribió:
>>
>> Luis,
>>
>> I've never personally used celery to queue tasks to execute in a web2py
>> environment.
>>
>> I found myself in a similar situation recently and just used a cron task
>> running a python script in the web2py environment from the command line.
>>
>> Is there a particular reason this workflow would not work for you?
>>
>> -Mark
>>
>> On Saturday, October 3, 2015 at 10:40:47 AM UTC-5, Luis Valladares wrote:
>>>
>>> But how can you exec a web2py task (who may uses web2py internal
>>> components like Request, response, db, etc..) with a external celery app? i
>>> mean, if i wish to execute a task, for example: To insert a new register in
>>> a table of my web2py database, and in enqueue this task to a remote (or
>>> local) celery worker to do it, how i can get this worker to know about all
>>> the "environment" of web2py? the only idea i have its creating a worker
>>> that is aware of the web2py environment, but i dont know how to do this.
>>>
>>> There is anyway to use celery queue to execute tasks that requires the
>>> web2py environment?
>>>
>>> El viernes, 2 de octubre de 2015, 5:46:35 (UTC-4:30), Niphlod escribió:

 I'd say you're loosing yourself in a glass of water. In order to
 schedule something, that something must work. If your "something" doesn't,
 it really doesn't matter what tool are you issuing commands to.

 On Friday, October 2, 2015 at 11:56:55 AM UTC+2, Stefan van den
 Eertwegh wrote:
>
> Hi Niphlod,
>
> Thanks for you answer.
>
> Why i am asking this is because i want to generate around 150 pdf's by
> weasyprint and per each pdf i want to queue a mail with it as an 
> attachment.
> Could this be done by the build in web2py Scheduler?
>
> PS: i tried the scheduler, but it tries to use the generic.html view
> but has not enough settings provided in the layout.html to use it, it 
> fails.
> is is not so that it executes the function from the model with
> database privileges and not uses a view? Or is it also using the default
> generic view?
>
> Thanks for responding!
>
> Best regards,
> Stefan
>
> Op vrijdag 2 oktober 2015 11:21:07 UTC+2 schreef Niphlod:
>>
>> you won't ever get to start workers from web2py, either with the
>> embedded scheduler, with rq or with celery.that's pretty much a
>> requirement (being completely separated)
>>
>> PS: celery integration was done on a so old release of celery that it
>> won't ever be production ready
>>
>> PS2: you don't need any web2py plugin to push task to celery.
>>
>>
>> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/YHsRsh0uQGo/unsubscribe.
> To unsubscribe from this group and all its topics, 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] Re: Static content seems to load with a 404 error... uwsgi nginx

2015-10-04 Thread Encompass solutions
Goodness me... How did I miss that!
And doesn't seem to be working in my server section for ssl... here is the 
adapted, section:
I assume the "location" should be before / is that right?  Does it make a 
difference?
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$
ssl_protocols SSLv3 TLSv1;
keepalive_timeout70;
location ~* /(\w+)/static/ {
root /var/www/web2py/applications/;
}
location / {
uwsgi_pass  unix:///tmp/web2py.sock;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}




On Sunday, October 4, 2015 at 1:24:03 PM UTC+3, Encompass solutions wrote:
>
> I have setup uwsgi and I seem to be very close to having everything 
> working.
> It just seems that my static data is not loaded now. (css, images, so 
> forth)
> This is my nginx file with the web2py applicaiton in it.
> Any ideas into the issue?  My web2py installation is located in 
> /var/www/web2py/.
> # file /etc/nginx/sites-available/web2py
> 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;
> #}
> location ~* /(\w+)/static/ {
> root /home/www-data/web2py/applications/;
> #remove next comment on production
> #expires max;
> }
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.sock;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> }
> }
> 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.sock;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> }
>
> }
>
>
>
>

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


[web2py] Re: ST_X function on POSTGIS geography() fields

2015-10-04 Thread 'DenesL' via web2py-users
How do you propose to code those functions if they are not available in the 
DB engine?.
MS SQL Server does have functions to extract longitude and latitude data 
from geography points but PostGIS does not seem to have them.

I can send in a patch for MSSQL with the following extended methods: Lat 
Long M Z
(last two being measure and elevation info)
and more functions are available depending on the version of MSSQL.

Denes

On Wednesday, September 30, 2015 at 4:56:56 PM UTC-4, wish7...@gmail.com 
wrote:
>
> Done: https://github.com/web2py/pydal/issues/298
>
> Cheers
> Toby
>
> Am Dienstag, 29. September 2015 23:17:37 UTC+2 schrieb wish...@gmail.com:
>>
>> +1 from my side too :-) Was a pydal ticket ever opened?
>> Otherwise I would do now...
>>
>> Cheers 
>> Toby
>>
>> Am Montag, 22. Juni 2015 08:51:59 UTC+2 schrieb Massimo Di Pierro:
>>>
>>> Please open a pydal ticket. I do not think we support this yet but we 
>>> can add it.
>>>
>>> On Wednesday, 23 April 2014 05:44:39 UTC-5, libe...@gmail.com wrote:

 Hi everyone,
 I am trying to extract latitude and longitude from a POSTGIS 
 geography() field. Unfortunately the usual st_x() and st_y() functions 
 normally used
 for geometry() fields won't work.
 How can I extract the required values or transform geography in 
 geometry?

 Thanks

>>>

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


Re: [web2py] Re: Web2py celery plugin

2015-10-04 Thread Luis Valladares
Thanks Mark! I think this will work, i will try it on the job and come here 
if i have any troubles.

El domingo, 4 de octubre de 2015, 8:59:37 (UTC-4:30), Mark Graves escribió:
>
> As documented in the web2py book,
>
> The "web2py.py" script can take many command-line arguments specifying the 
> maximum number of threads, enabling of SSL, etc. For a complete list type:
>
> >>> python web2py.py -h
>
> For example, a shell script called async_events.sh can be called at reboot as 
> follows:
>
> #! /bin/bash
>
> cd /home/www-data/web2py
>
> python web2py.py -S YOUR_APPLICATION_NAME -M -R 
> applications/YOUR_APPLICATION_NAME/private/async_events.py
>
>
> The contents of async_events.py are a simple python script run as if it 
> were a request from web2py
>
> For example:
>
> import time 
>
>  
>
> def create_pdfs(db):
>> while True:
>> ALL YOUR PDF PROCESSING LOGIC HERE
>
> time.sleep(60) 
>
>>  
>
>  
>
> create_pdfs(db)
>
>
>
> The above is an example script where your create_pdfs function handles all 
> the processing logic.
>
> The time.sleep(60) means run every minute.
>
> You would run this task once @reboot so python would handle the interval 
> between tasks.
>  
> From there, you can use all the internal web2py API including mail.send() 
> etc
>
>
> -Mark
>
>
>
> On Sun, Oct 4, 2015 at 8:16 AM, Luis Valladares  > wrote:
>
>> Hello mark! thanks for you answer.
>>
>> Your approach sounds really nice, but exactly how you run a cron task 
>> inside web2py environment? you start the web2py client with the console 
>> option and there execute the task? may you give me an example of this?
>>
>>
>> El domingo, 4 de octubre de 2015, 8:31:20 (UTC-4:30), Mark Graves 
>> escribió:
>>>
>>> Luis,
>>>
>>> I've never personally used celery to queue tasks to execute in a web2py 
>>> environment.
>>>
>>> I found myself in a similar situation recently and just used a cron task 
>>> running a python script in the web2py environment from the command line.
>>>
>>> Is there a particular reason this workflow would not work for you?
>>>
>>> -Mark
>>>
>>> On Saturday, October 3, 2015 at 10:40:47 AM UTC-5, Luis Valladares wrote:

 But how can you exec a web2py task (who may uses web2py internal 
 components like Request, response, db, etc..) with a external celery app? 
 i 
 mean, if i wish to execute a task, for example: To insert a new register 
 in 
 a table of my web2py database, and in enqueue this task to a remote (or 
 local) celery worker to do it, how i can get this worker to know about all 
 the "environment" of web2py? the only idea i have its creating a worker 
 that is aware of the web2py environment, but i dont know how to do this.

 There is anyway to use celery queue to execute tasks that requires the 
 web2py environment?

 El viernes, 2 de octubre de 2015, 5:46:35 (UTC-4:30), Niphlod escribió:
>
> I'd say you're loosing yourself in a glass of water. In order to 
> schedule something, that something must work. If your "something" 
> doesn't, 
> it really doesn't matter what tool are you issuing commands to.
>
> On Friday, October 2, 2015 at 11:56:55 AM UTC+2, Stefan van den 
> Eertwegh wrote:
>>
>> Hi Niphlod,
>>
>> Thanks for you answer.
>>
>> Why i am asking this is because i want to generate around 150 pdf's 
>> by weasyprint and per each pdf i want to queue a mail with it as an 
>> attachment.
>> Could this be done by the build in web2py Scheduler?
>>
>> PS: i tried the scheduler, but it tries to use the generic.html view 
>> but has not enough settings provided in the layout.html to use it, it 
>> fails.
>> is is not so that it executes the function from the model with 
>> database privileges and not uses a view? Or is it also using the default 
>> generic view?
>>
>> Thanks for responding!
>>
>> Best regards,
>> Stefan
>>
>> Op vrijdag 2 oktober 2015 11:21:07 UTC+2 schreef Niphlod:
>>>
>>> you won't ever get to start workers from web2py, either with the 
>>> embedded scheduler, with rq or with celery.that's pretty much a 
>>> requirement (being completely separated)
>>>
>>> PS: celery integration was done on a so old release of celery that 
>>> it won't ever be production ready
>>>
>>> PS2: you don't need any web2py plugin to push task to celery.
>>>
>>>
>>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/YHsRsh0uQGo/unsubscribe.
>> To unsubscribe from this group 

[web2py] Re: Static content seems to load with a 404 error... uwsgi nginx

2015-10-04 Thread Anthony
location ~* /(\w+)/static/ {
root /home/www-data/web2py/applications/;

should be:

location ~* /(\w+)/static/ {
root /var/www/web2py/applications/;

Also, you'll need to repeat that configuration in the SSL section if you 
want nginx to serve static files via HTTPS as well.

Anthony


On Sunday, October 4, 2015 at 6:24:03 AM UTC-4, Encompass solutions wrote:
>
> I have setup uwsgi and I seem to be very close to having everything 
> working.
> It just seems that my static data is not loaded now. (css, images, so 
> forth)
> This is my nginx file with the web2py applicaiton in it.
> Any ideas into the issue?  My web2py installation is located in 
> /var/www/web2py/.
> # file /etc/nginx/sites-available/web2py
> 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;
> #}
> location ~* /(\w+)/static/ {
> root /home/www-data/web2py/applications/;
> #remove next comment on production
> #expires max;
> }
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.sock;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> }
> }
> 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.sock;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> }
>
> }
>
>
>
>

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