[web2py] Web2py multiple table joins

2016-12-08 Thread mfarees . knysys
Hi
I want to write a query in web2py. The purpose of this query is to return 
all users that belong to a user group specified in the query. The 
additional data I want with each user is his organization (if any), 
managing_countries (if any), and shops (if any). Note that a user might 
*either* own a shop or work in an organization, but not both. A person 
working in an organization will also have a record in the 
managing_countries table.
I wrote a query but I did not get the desired results. It is returning data 
even when it is not present, so I think a left outer join is required here.

auth_managing_countries = db(db.managing_countries.user_id == auth.user.id).
select().first().countries
user_role_clause = ((db.auth_group.role == UserGroups.employee) |
(db.auth_group.role == UserGroups.owner))
auth_id_clause= user_role_clause &\
(db.auth_group.id == db.auth_membership.group_id
) &
(db.auth_membership.user_id == db.auth_user.id)
customer_country_clause = ((db.shop.country.belongs(auth_managing_countries
)) &
   (db.user_shop.shop_id == db.shop.id) &
   (db.user_shop.user_id == db.auth_user.id))
query = auth_id_clause & customer_country_clause
db(query).select()

Thanks

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


[web2py] Re: RSS concepts for handling multi-organization feeds

2016-12-08 Thread Alex Glaros
can someone please help me with the highlighted dictionary syntax below?

def feed():
from gluon.serializers import rss
functionSuperObjectID = request.get_vars.functionSuperObjectID
parentTitle = db.SuperObject(functionSuperObjectID).object_display_name
parentLink = db.SuperObject(functionSuperObjectID).object_display_name
parentDescription = 
db.SuperObject(functionSuperObjectID).object_display_name
response.view = 'generic.rss'
selected_rss_rows = db(db.rss_entry.super_object_fk == 
functionSuperObjectID).select(db.rss_entry.super_object_fk, 
db.rss_entry.title, db.rss_entry.link, db.rss_entry.created_on, 
db.rss_entry.description)
rssDict = dict()
for row in selected_rss_rows:
rssDict[row].title = row.title #what is syntax for this line?
rssDict[row].link = row.link
rssDict[row].pubDate = row.created_on
rssDict[row].description = row.description
return dict(title = parentTitle, link = parentLink, description = 
parentDescription, entries = [dict(rssDict)]) #what is syntax for this 
highlighted part?

-- 
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] reading file from path

2016-12-08 Thread J Boggy
I USE cv2.VideoCapture(os.path.join(reques.folder,'uploads','success.mp4') to 
get video frame from file which work well in my pc. But when i tested on vps it 
cannot read from path.how should intry

-- 
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: Syntax question: db(db.mytable.id == request.post_vars["id"]).update(**{key:value})

2016-12-08 Thread Henk huisman
Thanks,

I wrote this code and seems to work well...from an ajax call.
Post is with or without id; depending on if its a new record or an update

def save_selected():
a={} 
if request.vars["id"]:
for key, value in request.vars.items():
if key!="id":
a[key]=value
db(db.mytable.id == request.vars["id"]).update(**a)
else:
for key, value in request.vars.items():
a[key]=value
db.mytable.insert(**a)
return 

-- 
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: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-12-08 Thread Richard Vézina
Hello,

As far as I can see auth.groups() return up-to-date user group(s)
membership... Maybe it would issue of auth.user_groups() which is only
updated at login???

http://web2py.readthedocs.io/en/latest/_modules/gluon/tools.html#Auth.groups

I think using it will help me reduce the number of hit to the db for
membership check, as in my app I use to use auth.has_membership() a lot
inside the same controller as I use to display different things to user
depending of their role in the system... I can't afford to use
auth.user_groups() as I have a feature (if we can call it that) that allow
some user to switch there actual role in the system by them self...

So, I can make a tradeoff between ultimate performance improvement using
auth.user_groups() not it ot the database at all, or using auth.groups()
once at the top a controller, caching it for the time a form is submit and
then release the cache...

The only other solution I see would be to make sure I use
auth.update_groups() when chaging user role as it seems to update
auth.user_groups() :
http://web2py.readthedocs.io/en/latest/_modules/gluon/tools.html#Auth.update_groups

Actually I should do that when I manage user (creationm, membership, etc.)
as it seems to be the proper way to handle auth_* table operation anyway
which I didn't do back in time because of my lack of knowledge I guess...

But  I am not sure that if someone change other user membership, for
instance the admin changing some user membership, that it will be reflected
into every user auth.groups()... If I do modify other user membership, does
auth.groups() will reflect the new user membership??

Richard

On Sat, Nov 26, 2016 at 6:25 PM, Marlysson Silva 
wrote:

> Try this:
>
> auth.has_membership(group_id, user_id, role)
>
> The doc are here:
> http://web2py.com/books/default/chapter/29/09/access-control#Authorization
>
>
>
> Em sexta-feira, 25 de novembro de 2016 13:30:22 UTC-3, Ramos escreveu:
>>
>> can i change auth.has_membership(role) to another user?
>> i need to iterate over all users and find if they belong to some group.
>>
>> I have a list [4,5,1] with the id of the group i need to check.
>>
>> Regards
>> António
>>
>> 2016-11-12 0:08 GMT+00:00 Anthony :
>>
>>> On Friday, November 11, 2016 at 4:15:50 PM UTC-5, 黄祥 wrote:

 i assume the same thing goes to auth.user vs auth.is_logged_in(),
 auth.user faster than auth.is_logged_in() because auth.user didn't hit the
 database, isnt it?

>>>
>>> No, login status is maintained in the session -- auth.is_logged_in()
>>> does not hit the database. Note, you can always look at the source code to
>>> see how something works -- here's the body of that function:
>>>
>>> if self.user:
>>> return True
>>> return False
>>>
>>> As you can see, it's exactly equivalent to simply checking auth.user.
>>>
>>> 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+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.
>

-- 
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: What parts of web2py do not automatically get replaced when updating to new version?

2016-12-08 Thread Anthony
On Thursday, December 8, 2016 at 5:38:18 PM UTC-5, Alex Glaros wrote:
>
> so to stay current, whenever there is new web2py version we check for 
> differences/updates in the following?
>
>
>- appconfig.ini
>- menu.py
>- db.py
>- layout.html
>
> Generally, there should be no need to update any of the above. The 
scaffolding app includes those files as a starting point, but they are 
intended to be customized by you, not updated with the framework. Every one 
of those files should have code specific to your app, so why would you 
replace it with the default version that comes with the scaffolding app?

>
>- whole CSS, JS folders
>
> Probably not the CSS files.

Within the app folder, you generally only need to update web2py.js, 
web2py_ajax.html, appadmin.py, and appadmin.html.

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: Video write

2016-12-08 Thread J Boggy
Yes .i have been try 

Re: [web2py] Re: Web2py with ngix

2016-12-08 Thread Richard Vézina
Could you link issue here?


Richard

On Thu, Dec 8, 2016 at 5:03 PM,  wrote:

> I just posted an issue with uwsgi and setup-web2py-nginx-uwsgi-ubuntu.sh to
> the mailing list ( https://groups.google.com/forum/#!topic/web2py/U_
> GTzcdXdKE )
> This might possible be related..
>
> On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>
>> Web2py with ngix start work well.
>> But when i start uwsgi
>> it show  uwsgi.service not found error.
>> If i need to create service i don't know how to create.
>> I follow this way
>> https://www.digitalocean.com/community/tutorials/how-to-depl
>> oy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>>
> --
> 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] improving DAL for normalized DB

2016-12-08 Thread Richard Vézina
Hello Val K,

I am not sure I understand fully what your are talking about. On one hand,
I do understand that you would like a proper way to define SQL VIEW in
web2py and you propose to add a switch/flag/argument to define_table() to
do so, which would result in a select only table or something like that...
It could make sens, but I am not sure it would be accept base on my
experience it wouldn't pass as it seems a bit hacky and Massimo would not
implement it that way in DAL... Actually, I think there is no proper way to
implement view in DAL, and it a shame (we could have care more and answer
this need) that we don't have it... But you can define a view as a table in
web2py and use all the available feature regarding selection with this
"false" table (except create/read/update/delete obviously). You can also,
write a plain SQL SELECT and embeded it into a db.executesql() function.
Disavantage of the later method is that you can't access field with dot
notation db.table_name.field_name as web2py doesn't know about field and
even table name in this case, as db.executesql() return rows...

On the other hand, I heard you talk about "storedin" field and aliasing but
I don't really understand to which common pratice you refer there... Are
you talking of a normalized way to represent web2py list:reference field
with a proper many-to-many relation table or are you talking about
something else? Which level of normalization are you trying to achieve with
aliasing and storedin... I don't understand what you refering to here.


Thanks

Richard

On Thu, Dec 8, 2016 at 5:49 PM, Val K  wrote:

> It doesn't differ from reference fields. it is about automation
> distributed transaction.
> Table 'person' hasn't Field('alias_name' ) at db level, it's fake Field
> with reverse reference declaration ( 'storedin alias_opt.alias_name' ) that
> defines table.field that would be really involved in CRUD-process of table
> 'person'
>
> On Wednesday, December 7, 2016 at 5:29:28 AM UTC+3, Dave S wrote:
>>
>>
>> On Tuesday, December 6, 2016 at 3:41:38 PM UTC-8, Richard wrote:
>>>
>>> UP, never get any answer...
>>>
>>
>> How would this differ from reference fields?
>>
>> /dps
>>
>>
>>>
>>> On Sat, Jan 23, 2016 at 4:08 PM, Val K  wrote:
>>>
 Hi guys!
 I have an idea to improve DAL in scope of work with normalized DB.
 As known It's a common practice to avoid NULL value by creating
 separate (option) table(s) to store non required fields.
 So, it would be great to have a field type like "storedin
 table_name.field_name"
 For example:

 db.define_table('alias_opt', Field('name'),  Field('alias_name', 'reference
 person'))
 db.define_table('person', Field('name'),  Field('alias_name', 'storedin
 alias_opt.alias_name'))

 #INSERT:
 db.person.insert(name='Alex',  alias_name='Macedonian')
 # means:
id=db.person.insert(name='Alex')
db.alias_opt.insert(id=id, alias_name='Macedonian')

 #UPDATE:
 db(db.person.id==id).update(... , alias_name=None)
 # means:
   # update person
   ...
   # update option  table
   update_opt_args = filter_storedin_fields(update_args)
   opt_rec =  db.alias_opt(id)
   opt_rec.update(update_opt_args)
   if not any(opt_rec.values()): # -  all fields of option table record
 is None
  del  db.alias_opt(id)
 else:
  db.alias_opt.update_or_insert(id==id,   **update_opt_args)

 #DELETE:
 del db.person(id)  also means   del db.alias_opt(id),  like ondelete=
 'CASCADE'

 #SELECT:
 rows = db(db.person).select()
 # means:
  rows = db(db.person).select( left=[ db.alias_opt.on( db.alias_opt.id
 == db.person.id ) ] )
 but only "storedin" fields should be selected from  db.alis_opt
 and they should be accessed by row.alias_name (not only by row.
 joined_table.field_name )

 Considering, that table person could be a VIEW (i.e. JOIN is already
 performed at DB level),  there is no need to make join at web2py level,
 it could be fixed by passing an option arg like is_view=True to
 define_table()
 I know, that behavior of insert/update/delete could be easy realized by
 custom class based on Table
 with a little hacking Field-class to intercept field type to fix it to
 web2py type ( considering  person.alias_name.type ==
 alias_opt.alias_name.type ).
 But it's hard for me to change select() behavior, because there is only
 common_filter, but  there isn't  common_join/common_left with providing of
 maping (aliasing) joined table  fields  to  'storedin' fields.

 In fact, I dream of common_join depends on discriminator field, that
 will switch tables to be joined depend on discriminator value specified in
 the query (something like db.object.type_id==type_id),
 if descriminator is not specified or couldn't be resolved 

[web2py] RSS concepts for handling multi-organization feeds

2016-12-08 Thread Alex Glaros
My web2py app will offer RSS feeds for many organizations. How will 
consumers subscribe to the right one; is the following correct?

Create table:

db.define_table('rss_entry',
Field('organization_fk', 'integer'),
Field('title'),
Field('link'),
Field('created_on', 'datetime'),
Field('description'))

Then, in controller:

def feed():
from gluon.serializers import rss
response.view = 'generic.rss'
correct_org_rows = db(db.rss_entry.organization_fk == 
whatever_organization_ID_user_selected_in_previous_function).select(title, 
link, blah, blah, blah)
return 
dict(title=db.Organization(correct_org_rowsorganization.fk).name, 
link=db.Organization(correct_org_rowsorganization.fk).link, 
description=db.Organization(correct_org_rowsorganization.fk).rss_description, 
entries=[dict(title=correct_org_rows.title, link=correct_org_rowslink, 
description=correct_org_rows.description")])

going in right general direction?

thanks,

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] improving DAL for normalized DB

2016-12-08 Thread Val K
It doesn't differ from reference fields. it is about automation distributed 
transaction. 
Table 'person' hasn't Field('alias_name' ) at db level, it's fake Field 
with reverse reference declaration ( 'storedin alias_opt.alias_name' ) that 
defines table.field that would be really involved in CRUD-process of table 
'person'

On Wednesday, December 7, 2016 at 5:29:28 AM UTC+3, Dave S wrote:
>
>
> On Tuesday, December 6, 2016 at 3:41:38 PM UTC-8, Richard wrote:
>>
>> UP, never get any answer...
>>
>
> How would this differ from reference fields?
>
> /dps
>  
>
>>
>> On Sat, Jan 23, 2016 at 4:08 PM, Val K  wrote:
>>
>>> Hi guys!
>>> I have an idea to improve DAL in scope of work with normalized DB.
>>> As known It's a common practice to avoid NULL value by creating separate 
>>> (option) table(s) to store non required fields.  
>>> So, it would be great to have a field type like "storedin 
>>> table_name.field_name" 
>>> For example:
>>>
>>> db.define_table('alias_opt', Field('name'),  Field('alias_name', 'reference 
>>> person'))
>>> db.define_table('person', Field('name'),  Field('alias_name', 'storedin 
>>> alias_opt.alias_name'))
>>>
>>> #INSERT:
>>> db.person.insert(name='Alex',  alias_name='Macedonian') 
>>> # means:
>>>id=db.person.insert(name='Alex')
>>>db.alias_opt.insert(id=id, alias_name='Macedonian')  
>>>
>>> #UPDATE:
>>> db(db.person.id==id).update(... , alias_name=None)
>>> # means:
>>>   # update person
>>>   ...
>>>   # update option  table
>>>   update_opt_args = filter_storedin_fields(update_args) 
>>>   opt_rec =  db.alias_opt(id)
>>>   opt_rec.update(update_opt_args)
>>>   if not any(opt_rec.values()): # -  all fields of option table record 
>>> is None
>>>  del  db.alias_opt(id)  
>>> else:
>>>  db.alias_opt.update_or_insert(id==id,   **update_opt_args)
>>>
>>> #DELETE:
>>> del db.person(id)  also means   del db.alias_opt(id),  like ondelete=
>>> 'CASCADE'
>>>
>>> #SELECT:
>>> rows = db(db.person).select()
>>> # means:
>>>  rows = db(db.person).select( left=[ db.alias_opt.on( db.alias_opt.id == 
>>> db.person.id ) ] )
>>> but only "storedin" fields should be selected from  db.alis_opt 
>>> and they should be accessed by row.alias_name (not only by row.
>>> joined_table.field_name )
>>>
>>> Considering, that table person could be a VIEW (i.e. JOIN is already 
>>> performed at DB level),  there is no need to make join at web2py level,
>>> it could be fixed by passing an option arg like is_view=True to 
>>> define_table() 
>>> I know, that behavior of insert/update/delete could be easy realized by 
>>> custom class based on Table 
>>> with a little hacking Field-class to intercept field type to fix it to 
>>> web2py type ( considering  person.alias_name.type == 
>>> alias_opt.alias_name.type ).
>>> But it's hard for me to change select() behavior, because there is only 
>>> common_filter, but  there isn't  common_join/common_left with providing of 
>>> maping (aliasing) joined table  fields  to  'storedin' fields. 
>>>
>>> In fact, I dream of common_join depends on discriminator field, that 
>>> will switch tables to be joined depend on discriminator value specified in 
>>> the query (something like db.object.type_id==type_id),
>>> if descriminator is not specified or couldn't be resolved at web2py 
>>> level, it performs left join all tables (from a list containing possible 
>>> common_join tables)
>>>
>>> P.S. May be I try to reinvent the wheel, so feel free to shoot me!
>>>
>>> -- 
>>> 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: What parts of web2py do not automatically get replaced when updating to new version?

2016-12-08 Thread Alex Glaros
so to stay current, whenever there is new web2py version we check for 
differences/updates in the following?


   - appconfig.ini
   - menu.py
   - db.py
   - layout.html
   - whole CSS, JS folders
   


-- 
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] What parts of web2py do not automatically get replaced when updating to new version?

2016-12-08 Thread Anthony
Nothing in your application folder gets updated. Everything else does.

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: check boxes with is_in_set

2016-12-08 Thread Jim Russell
Rob,

I used this code to get a list with checkboxes.

form=SQLFORM.factory(
Field('hostnames',"list:string", 
default=hostnames,widget=SQLFORM.widgets.checkboxes.widget,requires=[IS_IN_SET(hostnames,multiple=True),IS_NOT_EMPTY()]))

hostnames is a list containing strings.

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

2016-12-08 Thread wish7code
I just posted an issue with uwsgi and setup-web2py-nginx-uwsgi-ubuntu.sh to 
the mailing list ( 
https://groups.google.com/forum/#!topic/web2py/U_GTzcdXdKE )
This might possible be related..

On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>
> Web2py with ngix start work well.
> But when i start uwsgi 
> it show  uwsgi.service not found error.
> If i need to create service i don't know how to create.
> I follow this way
>
> https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>

-- 
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] Systemd/uwsgi issue on setup-web2py-nginx-uwsgi-ubuntu.sh install

2016-12-08 Thread Richard Vézina
Did you take the last version of the script the one available in trunk (or
github master)?

I not, try that version of the script first...

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

If you still experiment the same problem consider open an issue :

https://github.com/web2py/web2py/issues

Thanks

Richard

On Thu, Dec 8, 2016 at 4:46 PM,  wrote:

> Hello friends,
>
> I started a new web2py project on ubuntu 16.04 from scratch using
> https://github.com/web2py/web2py/blob/master/scripts/
> setup-web2py-nginx-uwsgi-ubuntu.sh
>
> When trying to access the website I get 502 bad gateway errors, probably
> related to an uwsgi issue.
> This is the systemctl output:
>
> $ systemctl status emperor.uwsgi.service
> ● emperor.uwsgi.service - uWSGI Emperor
>Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled;
> vendor preset: enabled)
>Active: inactive (dead)
>
> If I start uwsgi manually, everything works fine, i.e.
>
> $ systemctl start emperor.uwsgi.service
> ● emperor.uwsgi.service - uWSGI Emperor
>Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled;
> vendor preset: enabled)
>Active: active (running) since Thu 2016-12-08 22:36:02 CET; 8s ago
>  Main PID: 1404 (uwsgi)
>Status: "uWSGI is ready"
> Tasks: 5
>Memory: 32.5M
>   CPU: 190ms
>CGroup: /system.slice/emperor.uwsgi.service
>├─1404 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>├─1417 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>├─1418 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>├─1419 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>└─1420 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>
>
>
> $ /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini   works too
>
> Any idea, how I could fix/debug this?
>
> Thanks & cheers
> Toby
>
> --
> 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] Systemd/uwsgi issue on setup-web2py-nginx-uwsgi-ubuntu.sh install

2016-12-08 Thread wish7code
Hello friends,

I started a new web2py project on ubuntu 16.04 from scratch using 
https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

When trying to access the website I get 502 bad gateway errors, probably 
related to an uwsgi issue.
This is the systemctl output:

$ systemctl status emperor.uwsgi.service
● emperor.uwsgi.service - uWSGI Emperor
   Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; 
vendor preset: enabled)
   Active: inactive (dead)

If I start uwsgi manually, everything works fine, i.e.

$ systemctl start emperor.uwsgi.service
● emperor.uwsgi.service - uWSGI Emperor
   Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; 
vendor preset: enabled)
   Active: active (running) since Thu 2016-12-08 22:36:02 CET; 8s ago
 Main PID: 1404 (uwsgi)
   Status: "uWSGI is ready"
Tasks: 5
   Memory: 32.5M
  CPU: 190ms
   CGroup: /system.slice/emperor.uwsgi.service
   ├─1404 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
   ├─1417 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
   ├─1418 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
   ├─1419 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
   └─1420 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini



$ /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini   works too

Any idea, how I could fix/debug this?

Thanks & cheers
Toby

-- 
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] check boxes with is_in_set

2016-12-08 Thread R U
hi all,

I understand this might be too much in the realm of "please write my code
for me" with that in mind let me ask.
Is it possible to use -- is_in_set -- to create a list of check boxes
instead of a drop-down?

what I am doing is: two types of users.  both have access to the same list.
 user type 1) can choose any and all of the items; user type 2) can only
choose 1.

I employ a drop down and is_in_set for the second type of user and that is
exactly what I am looking for.
Field('yo', requires=IS_IN_SET(['fl', 'ch',  'Fo',  'Mo',  'Ma', 'Ca',
'Foo', 'Mai', ...]))

The other I have a bunch of boolean fields such as.

Field('fl', 'boolean'),
Field('ch', 'boolean'),
Field('Fo', 'boolean'),
Field('Mo', 'boolean'),
Field('Ma', 'boolean'),
Field('Ca', 'boolean'),
Field('Foo', 'boolean'),
Field('Mai', 'boolean'),
Field

I would rather do this similar to the prior example, i.e. using a list.  I
think it would give me greater control over styling in the view and other
iterations I am planning on doing.  And I would like to keep originating
this from the model because all the model has to offer.

Thank you

Rob

-- 
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] What parts of web2py do not automatically get replaced when updating to new version?

2016-12-08 Thread Alex Glaros
Some components of web2py, such as menu.py and layout.html, stay the same 
when updating to new version.

What is the list of components that are not automatically updated, but 
require eventual modernization, such as layout.html?

thanks

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.


[web2py] assign content to sqlform help-block

2016-12-08 Thread Pierre
Hi,

How do I reach a certain SQLFORM help-block span from a controller ?  / or 
is it there to serve as  js target ? 

thanks

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


[web2py] Re: Blog Template - Github

2016-12-08 Thread David
Thanks for replying 

The correct address is 
http://hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123 

I created the repository but step two has me stumped. Can you elaborate?

-- 
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: Removing need for first and last name in auth

2016-12-08 Thread 黄祥
i think you can use conditional if to check the url and then hide the fields
e.g.
if 'register' in request.args :
db.auth_user.first_name.readable = db.auth_user.first_name.writable = False
db.auth_user.last_name.readable = db.auth_user.last_name.writable = False 

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: table headers with style

2016-12-08 Thread Paolo Caruccio
*Premise*
bootstrap tables with striped rows have the following classes:

 - table
 - table-striped

reference: http://getbootstrap.com/css/#tables

*Padding*
bootstrap .table class assigns a padding of 8px to th and td elements while 
in stupid the th and td padding is 5px
So in order to assign a different value we should set

.table.myeheaders th,
.table.myeheaders td {
 /* top | right | bottom | left */
padding: 0 0 0 0;   /* change values as you like  */
}


*Table width*
bootstrap .table has a width of 100%
So in order to give a natural width to the table.table we should set

.table.myeheaders {
width:auto;
}


Our code becomes:


.table.myeheaders {width:auto;}
.table.myeheaders th,
.table.myeheaders td {
 /* top | right | bottom | left */
padding: 0 0 0 0;   /* change values as you like  */
}
.table-striped .w2p_odd.odd {background-color:#ddffcc;}



{{extend 'layout.html'}}
This is the default/sorted.html template
{{=SQLTABLE(rows, truncate=30, headers = {'tbl1.a':'Ayy', 'tbl1.b':'Bee', 
'tbl1.c':'Cee', 'tbl1.d':'Dee'}, 
columns=['tbl1.a', 'tbl1.b', 'tbl1.c', 'tbl1.d'], _class="table 
table-striped myeheaders")}}



Il giorno giovedì 8 dicembre 2016 08:03:53 UTC+1, Dave S ha scritto:
>
>
>
> On Wednesday, December 7, 2016 at 3:02:10 PM UTC-8, Paolo Caruccio wrote:
>>
>> Below code should work with bootstrap and stupid.css
>>
>> 
>> .table.myeheaders th {padding-right:2em;}
>> .table-striped .w2p_odd.odd {background-color:#ddffcc;}
>> 
>>
>> {{extend 'layout.html'}}
>> This is the default/sorted.html template
>> {{=SQLTABLE(rows, truncate=30, headers = {'tbl1.a':'Ayy', 'tbl1.b':'Bee', 
>> 'tbl1.c':'Cee', 'tbl1.d':'Dee'}, 
>> columns=['tbl1.a', 'tbl1.b', 'tbl1.c', 'tbl1.d'], _class="table 
>> table-striped myeheaders")}}
>>
>>
>> Some readings:
>>
>> https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
>> https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors
>>
>>
>>
> The table class does interesting things, but not what I want.   That gave 
> 8px padding on all 4 sides, and the columns divided up the full width.   
> Better than the default styling, but I prefer a more compact look.
>
> What I have now is
>
> 
> .myeheaders th {padding-right:2em;}
> .table-striped .w2p_odd.odd {background-color:#ddffcc;}
> 
>
> {{extend 'layout.html'}}
> This is the default/sorted.html template
> {{=SQLTABLE(rows, truncate=30, headers = {'tbl1.a':'Ayy', 'tbl1.b':'Bee', 
> 'tbl1.c':'Cee', 'tbl1.d':'Dee'}, 
> columns=['tbl1.a', 'tbl1.b', 'tbl1.c', 'tbl1.d'], 
> _class="table-striped myeheaders")}}
>
>
>  Interesting that that looks like your first post ... I must have missed 
> something on the earlier try.
>
> Thanks for your help.
>
> /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: Blog Template - Github

2016-12-08 Thread David
Thanks for replying 

The correct address is 
http://hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123 

I created the repository but step two has me stumped. Can you elaborate?

-- 
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: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-12-08 Thread Kenwyn Pilgrim
Massimo

Thank you.

On Friday, December 2, 2016 at 5:18:51 PM UTC-5, Massimo Di Pierro wrote:
>
> 1. I do not now. that is outside of web2py control. it is controlled by 
> the browser
> 2. you can just use
>
> form = SQLFORM.factory(Field('myfile','upload')).process()
>
> and then if form.accepted:
>
> request.vars.myfile.file.seek(0)
> data = request.vars.myfile.file.read()
>
>
>
>
> On Thursday, 1 December 2016 09:15:25 UTC-6, Kenwyn Pilgrim wrote:
>>
>> Massimo
>>
>> Thanks. This works. Just 2 follow-up questions.
>>
>>
>>1. Why does the *Choose File* button continue to say *No file chosen*? 
>>(The form submits though, with no validation errors)
>>
>>2. Can this be done with *SQLFORM.factory *instead of *SQLFORM*? 
>>Meaning that when I set the defaults, including setting the data for 
>> field 
>>that represents the upload file, I expect that if I hit the submit button 
>>as my first action, validation should be passed. What happens instead is 
>>that a validation error occurs that makes it seem that a file had not 
>> been 
>>had not been chosen.
>>
>> (*I noticed the online book (6th edition) does not have any info under 
>> the section Uploading Files with 
>> SQLFORM.factory.(http://www.web2py.com/book/default/chapter/07#Uploading-files-with-SQLFORMfactory
>>  
>> )*
>> )
>>
>> On Friday, November 25, 2016 at 11:17:51 PM UTC-5, Massimo Di Pierro 
>> wrote:
>>
>>> You are you doing this:
>>>
>>> if edit_mode:
>>>
>>> id = int(request.args[0])
>>>
>>> q = db.upload_file.id == id
>>>
>>> rows = db(q).select()
>>>
>>> for row in rows:
>>>
>>> for field in row:
>>>
>>> if field in db.upload_file.fields:
>>>
>>> db.upload_file[field].default = row[field]
>>>
>>>  
>>>
>>> ... 
>>>
>>> form = SQLFORM.factory(db.upload_file, fields=fields,
>>>
>>>submit_button=T('Add to Print Queue') if not 
>>> edit_mode else T('Update Queue'),
>>>
>>>upload=URL('download'))
>>>
>>> Instead of
>>>
>>>button = T('Add to Print Queue') if not edit_mode 
>>> else T('Update Queue')
>>>form = SQLFORM(db.upload_file,  
>>>request.args(0,cast=int,default=0), 
>>>upload=URL('download'), 
>>> submit_button=button).process()
>>>
>>>
>>> On Monday, 21 November 2016 09:42:54 UTC-6, Kenwyn Pilgrim wrote:

 I too have this issue with using SQLFORM.factory to edit.

 My model looks like:

 db.define_table('upload_file',

 Field('doc_type', 'reference document_type', 
 required=True, label=T('Type')),

 Field('pdf_name', 'upload', label=T('PDF Document'),

   uploadfolder=os.path.join(request.folder, 'uploads', 
 'user_data')),...)


 my controller looks like:

 ...


 edit_mode = len(request.args) > 0

 if edit_mode:

 id = int(request.args[0])

 q = db.upload_file.id == id

 rows = db(q).select()

 for row in rows:

 for field in row:

 if field in db.upload_file.fields:

 db.upload_file[field].default = row[field]

  

 ... 

 form = SQLFORM.factory(db.upload_file, fields=fields,

submit_button=T('Add to Print Queue') if not 
 edit_mode else T('Update Queue'),

upload=URL('download'))

 ... 


 If I am in edit mode and hit the "Update Queue" button, I get the 
 validation error "Please select a file", even though I have prepopulated 
 the defaults.

 I have to click the "Choose File" button to select a file *again, *then it 
 works.


 Please help.

 Thanks.


 On Saturday, April 6, 2013 at 11:22:32 AM UTC-5, Massimo Di Pierro 
 wrote:
>
> what are the models?
>
> On Tuesday, 2 April 2013 12:19:12 UTC-5, Ramos wrote:
>>
>> Back to business after almost 2 months i try again to use 
>> sqlform.factory to create and edit documents
>> My problem was to generate the link
>> i rearranged my code as follows
>>
>>
>> #if edit a document
>>  if request.args(0):
>>
>> row=db((db.trabalhador.id==request.args(0))).select().first()
>> 
>> empresa=row.empresa
>> 
>> foto=row['foto'] or None
>> #print foto
>> if row:
>> for field in row:
>>
>> if field in db.trabalhador.fields:
>>#POPULATE FIELDS with record to edit
>> db.trabalhador[field].default=row[field]

[web2py] Re: Blog Template - Github

2016-12-08 Thread Marlysson Silva
With relation with expires in pythonanywhere you can renew your 
application..

- Could be increase your layout
- The second link doesn't working.

To push your code to github your just have that :

- Create repository in github.
- git init in your folder.
- add remote ( repository's link ) ex. github.com/blablabla.git
git push remote

git init
git remote add origin link_repository
git push origin master

Some doubt just call me.


Em quarta-feira, 7 de dezembro de 2016 17:03:15 UTC-3, David escreveu:
>
> Hello, 
>
>
> I made my personal website with web2py a month or two ago. I's a dating 
> website and I haven't encountered any problems, although I have not had the 
> need to scale or anything just yet. 
>
>
> I've made a blog template for a client and I want to share it with anyone 
> that may be interested so that they can worry about the content of their 
> website and not the inner workings. The blog is located at 
> *hypenews.pythonanywhere.com 
> *. You can create posts, edit 
> comments, and change your categories/slideshow image at 
> *hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123 
> *
>
> If anyone has any feedback or ideas that I could add into it then I'd 
> appreciate that. I'm actively maintaining it. 
>
> I intend for it to be open source on github, but I don't know how to push 
> an app to github. Can Someone give me the steps or point me to something 
> that I can read? 
>
>
> Please note that this app is hosted for free at the moment just so others 
> can see a finished product. it expires in 3 months. i'll continue to use it 
> in conjunction with my own website though. 
>
>
> Blog - *hypenews.pythonanywhere.com* 
> Create post- 
> *hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123* 
> 
>

-- 
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: Video write

2016-12-08 Thread Marlysson Silva
Already the videos stay in static/videos folder .. try make this in your 
html template file:





this it html syntax .. in web2py you just handle views and controller to 
redirect template right.

Em quinta-feira, 8 de dezembro de 2016 12:11:28 UTC-3, J Boggy escreveu:
>
> i use opencv in web2py to process video frame. And then write video into 
> static/videos folder . It creates successfully .but i don't have any idea 
> to read video fom static/videos folder from html video src.

-- 
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] Scheduler - no workers working...

2016-12-08 Thread António Ramos
IT works now.
Thank you...

2016-12-08 12:42 GMT+00:00 Anthony :

> Have you scheduled any tasks? It always helps to show your code.
>
> --
> 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] Jquery Decision Tree

2016-12-08 Thread Mark Billion
Im really looking just for some suggestions of particularly light weight 
ones

-- 
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: Pass a query from form to another function

2016-12-08 Thread Marlysson Silva
Can't by definition of DAL code? or by security..

Em quarta-feira, 7 de dezembro de 2016 16:56:20 UTC-3, Anthony escreveu:
>
> On Wednesday, December 7, 2016 at 9:33:16 AM UTC-5, Marlysson Silva wrote:
>>
>> You can use sessions..
>>
>> session.content = query_search
>>
>
> A Query object can't be pickled to store it in the session, but you can 
> first convert to a dictionary:
>
> session.search_query = search_query.as_dict(flat=True)
>
> Then in the second function:
>
> db(session.search_query).select()
>
> 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: Web2py with ngix

2016-12-08 Thread Richard Vézina
No problem...

You maybe could post diff of your change, it would greatly help to
understand what you change.

Maybe it get rejected because it was applying for Debian only?

Anyway thanks for your contribution, I just want to point you in the rigth
direction to improve chance your work didn't get lost on the list as it
happen sometimes.

:)

Richard



On Thu, Dec 8, 2016 at 10:29 AM, Mirek Zvolský  wrote:

> Hi Richard.
>
> I'm beginner with Linux (upgrade from Windows to Linux was one of best
> steps in my professional life!).
> However at this time it is for me not good idea to write bash scripts for
> some complex product.
>
> In fact I made PR in this case (when I have added something from other
> post in this user group into the Web2py nginx/ubuntu script).
> It was not accepted, but maybe the team has implemented/reimplemented the
> changes into the framework full or partially.
>
> But I am not sure about this (and haven't time to test it).
> This is the reason why I have written:
>   - give first opportunity to the script from framework (github
> web2py/web2py),
>   - if it fails, then (maybe) my version could work.
>
>
>
>
> On Thursday, 8 December 2016 16:08:32 UTC+1, Richard wrote:
>>
>> Hello Mirek,
>>
>> Your contribution is pretty much appreciate, but it would make more sens
>> that you submit your improvements as a PR over github and then point other
>> users over you fork or the PR pending acceptation our your commit once PR
>> accepted...
>>
>> Thanks for your help
>>
>> Richard
>>
>> On Thu, Dec 8, 2016 at 7:27 AM, Mirek Zvolský  wrote:
>>
>>> One thing more
>>> In my opinion the service is controlled without ".service" in name.
>>>
>>> systemctl start emperor.uwsgi(if 
>>> /etc/systemd/system/emperor.uwsgi.service
>>> used)
>>>
>>> systemctl start uwsgi(if the name is /etc/systemd/system/uwsgi.service
>>> as (maybe) in your 'digitalocean' article)
>>>
>>>
>>>
>>>
>>>
>>> On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>>>
 Web2py with ngix start work well.
 But when i start uwsgi
 it show  uwsgi.service not found error.
 If i need to create service i don't know how to create.
 I follow this way
 https://www.digitalocean.com/community/tutorials/how-to-depl
 oy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04

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

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

2016-12-08 Thread Mirek Zvolský
Hi Richard.

I'm beginner with Linux (upgrade from Windows to Linux was one of best 
steps in my professional life!).
However at this time it is for me not good idea to write bash scripts for 
some complex product.

In fact I made PR in this case (when I have added something from other post 
in this user group into the Web2py nginx/ubuntu script).
It was not accepted, but maybe the team has implemented/reimplemented the 
changes into the framework full or partially.

But I am not sure about this (and haven't time to test it).
This is the reason why I have written:
  - give first opportunity to the script from framework (github 
web2py/web2py),
  - if it fails, then (maybe) my version could work.




On Thursday, 8 December 2016 16:08:32 UTC+1, Richard wrote:
>
> Hello Mirek,
>
> Your contribution is pretty much appreciate, but it would make more sens 
> that you submit your improvements as a PR over github and then point other 
> users over you fork or the PR pending acceptation our your commit once PR 
> accepted...
>
> Thanks for your help
>
> Richard
>
> On Thu, Dec 8, 2016 at 7:27 AM, Mirek Zvolský  > wrote:
>
>> One thing more
>> In my opinion the service is controlled without ".service" in name.
>>
>> systemctl start emperor.uwsgi(if 
>> /etc/systemd/system/emperor.uwsgi.service used)
>>
>> systemctl start uwsgi(if the name is 
>> /etc/systemd/system/uwsgi.service as (maybe) in your 'digitalocean' article)
>>
>>
>>
>>
>>
>> On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>>
>>> Web2py with ngix start work well.
>>> But when i start uwsgi 
>>> it show  uwsgi.service not found error.
>>> If i need to create service i don't know how to create.
>>> I follow this way
>>>
>>> https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>>>
>> -- 
>> 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.


Re: [web2py] Re: Ubuntu 16.04 - installation script stops

2016-12-08 Thread Richard Vézina
Hello Mirek,

Can send a PR over github so we get a better idea what your improvements
are and can include them more easily.

Thanks

Richard

On Thu, Dec 8, 2016 at 7:31 AM, Mirek Zvolský  wrote:

> The link is no longer working.
> Here is the script. This version worked for me:
>
> #!/bin/bash
> echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
> echo 'Requires Ubuntu > 12.04 or Debian >= 8 and installs Nginx + uWSGI +
> Web2py'
> # Check if user has root privileges
> if [[ $EUID -ne 0 ]]; then
>echo "You must run the script as root or using sudo"
>exit 1
> fi
> # parse command line arguments
> nopassword=0
> nocertificate=0
> while [ "$#" -gt 0 ]; do
>   case "$1" in
> --no-password) nopassword=1; shift 1;;
> --no-certificate) nocertificate=1; shift 1;;
>   esac
> done
> # Get Web2py Admin Password
> if [ "$nopassword" -eq 0 ]
> then
>   echo -e "Web2py Admin Password: \c "
>   read  PW
> fi
> # Upgrade and install needed software
> apt-get update
> apt-get -y upgrade
> apt-get autoremove
> apt-get autoclean
> apt-get -y install nginx-full
> apt-get -y install build-essential python-dev libxml2-dev python-pip unzip
> pip install setuptools --no-use-wheel --upgrade
> PIPPATH=`which pip`
> $PIPPATH install --upgrade uwsgi
> # Create common nginx sections
> mkdir /etc/nginx/conf.d/web2py
> echo '
> gzip_static on;
> gzip_http_version   1.1;
> gzip_proxiedexpired no-cache no-store private auth;
> gzip_disable"MSIE [1-6]\.";
> gzip_vary   on;
> ' > /etc/nginx/conf.d/web2py/gzip_static.conf
> echo '
> gzip on;
> gzip_disable "msie6";
> gzip_vary on;
> gzip_proxied any;
> gzip_comp_level 6;
> gzip_buffers 16 8k;
> gzip_http_version 1.1;
> gzip_types text/plain text/css application/json application/x-javascript
> text/xml application/xml application/xml+rss text/javascript;
> ' > /etc/nginx/conf.d/web2py/gzip.conf
> # Create configuration file /etc/nginx/sites-available/web2py
> echo '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 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;
> }
> ###
>
> ###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 / {
> #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-A
> ES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> 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;
> ###
> }
> ###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 want to use pre-gzipped static files (recommended)
> ### check 

[web2py] Video write

2016-12-08 Thread J Boggy
i use opencv in web2py to process video frame. And then write video into 
static/videos folder . It creates successfully .but i don't have any idea to 
read video fom static/videos folder from html video src.

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

2016-12-08 Thread Richard Vézina
Hello Mirek,

Your contribution is pretty much appreciate, but it would make more sens
that you submit your improvements as a PR over github and then point other
users over you fork or the PR pending acceptation our your commit once PR
accepted...

Thanks for your help

Richard

On Thu, Dec 8, 2016 at 7:27 AM, Mirek Zvolský  wrote:

> One thing more
> In my opinion the service is controlled without ".service" in name.
>
> systemctl start emperor.uwsgi(if /etc/systemd/system/emperor.uwsgi.service
> used)
>
> systemctl start uwsgi(if the name is /etc/systemd/system/uwsgi.service
> as (maybe) in your 'digitalocean' article)
>
>
>
>
>
> On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>
>> Web2py with ngix start work well.
>> But when i start uwsgi
>> it show  uwsgi.service not found error.
>> If i need to create service i don't know how to create.
>> I follow this way
>> https://www.digitalocean.com/community/tutorials/how-to-depl
>> oy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>>
> --
> 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: Removing need for first and last name in auth

2016-12-08 Thread Alexei Vinidiktov
I've added these lines, and now the fields are hidden both on the signup 
page and on the profile page.

How can I make the fields hidden only on the signup page? 

I want the user to be able to add their name later on the profile page.

On Monday, January 30, 2012 at 8:14:09 AM UTC+7, Massimo Di Pierro wrote:
>
> I suggest you simply make the fields hidden 
>
> db.auth_user.first_name.readable = db.auth_user.first_name.writable = 
> False 
> db.auth_user.last_name.readable = db.auth_user.last_name.writable = 
> False 
>
> On Jan 29, 6:36 pm, HittingSmoke  wrote: 
> > I'd like to use auth with only a username instead of first and last 
> > name. I defined my own tables without a first and last name but it 
> > still causes issues throughout the app. 
> > 
> > For instance, when I try to use appadmin to add a user to a new auth 
> > group I get an error ( 'first_name') if 
> > there is no first and last name fields in the database. If I create 
> > them but make them unreadable and unwritable the page will load but 
> > all of the entries in the User ID dropdown say "None None (user ID 
> > #)". 
> > 
> > The auth Welcome bar is also fixed to the first name field and if not 
> > used it will says Welcome, None. 
> > 
> > This seems like quite a huge oversight for such a robust auth system. 
> > Usernames are far more common for user management than first and last 
> > names and many people just plain refuse to give their real names to 
> > random web sites that require authentication. 
> > 
> > Is there a modded version of auth perhaps that can be used as a 
> > plugin? Excuse me if that sounds stupid, I'm just started out with 
> > this and could very well just be going about this all wrong.

-- 
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] Scheduler - no workers working...

2016-12-08 Thread Anthony
Have you scheduled any tasks? It always helps to show your code.

-- 
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: Ubuntu 16.04 - installation script stops

2016-12-08 Thread Mirek Zvolský
The link is no longer working.
Here is the script. This version worked for me:

#!/bin/bash
echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
echo 'Requires Ubuntu > 12.04 or Debian >= 8 and installs Nginx + uWSGI + 
Web2py'
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
   echo "You must run the script as root or using sudo"
   exit 1
fi
# parse command line arguments
nopassword=0
nocertificate=0
while [ "$#" -gt 0 ]; do
  case "$1" in
--no-password) nopassword=1; shift 1;;
--no-certificate) nocertificate=1; shift 1;;
  esac
done
# Get Web2py Admin Password
if [ "$nopassword" -eq 0 ]
then
  echo -e "Web2py Admin Password: \c "
  read  PW
fi
# Upgrade and install needed software
apt-get update
apt-get -y upgrade
apt-get autoremove
apt-get autoclean
apt-get -y install nginx-full
apt-get -y install build-essential python-dev libxml2-dev python-pip unzip
pip install setuptools --no-use-wheel --upgrade
PIPPATH=`which pip`
$PIPPATH install --upgrade uwsgi
# Create common nginx sections
mkdir /etc/nginx/conf.d/web2py
echo '
gzip_static on;
gzip_http_version   1.1;
gzip_proxiedexpired no-cache no-store private auth;
gzip_disable"MSIE [1-6]\.";
gzip_vary   on;
' > /etc/nginx/conf.d/web2py/gzip_static.conf
echo '
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript 
text/xml application/xml application/xml+rss text/javascript;
' > /etc/nginx/conf.d/web2py/gzip.conf
# Create configuration file /etc/nginx/sites-available/web2py
echo '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 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;
}
###

###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 / {
#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 TLSv1 TLSv1.1 TLSv1.2;
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;
###
}
###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 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;
}
###

}' >/etc/nginx/sites-available/web2py

ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py
rm /etc/nginx/sites-enabled/default
mkdir /etc/nginx/ssl
cd /etc/nginx/ssl
if [ "$nocertificate" -eq 0 ]
then
  openssl genrsa 1024 > web2py.key
  chmod 400 web2py.key
  openssl req -new -x509 -nodes -sha1 -days 1780 -key 

[web2py] Re: Web2py with ngix

2016-12-08 Thread Mirek Zvolský
One thing more
In my opinion the service is controlled without ".service" in name.

systemctl start emperor.uwsgi(if 
/etc/systemd/system/emperor.uwsgi.service used)

systemctl start uwsgi(if the name is /etc/systemd/system/uwsgi.service 
as (maybe) in your 'digitalocean' article)





On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>
> Web2py with ngix start work well.
> But when i start uwsgi 
> it show  uwsgi.service not found error.
> If i need to create service i don't know how to create.
> I follow this way
>
> https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>

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

2016-12-08 Thread Mirek Zvolský
And here is the version of script that I have used (I hope so) to install 
on my machine.

So if you decide use the installation script 
setup-web2py-nginx-uwsgi-ubuntu.sh
maybe you could try the version from current trunk github.com/web2py/web2py
and as second one you can try this version:

#!/bin/bash
echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
echo 'Requires Ubuntu > 12.04 or Debian >= 8 and installs Nginx + uWSGI + 
Web2py'
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
   echo "You must run the script as root or using sudo"
   exit 1
fi
# parse command line arguments
nopassword=0
nocertificate=0
while [ "$#" -gt 0 ]; do
  case "$1" in
--no-password) nopassword=1; shift 1;;
--no-certificate) nocertificate=1; shift 1;;
  esac
done
# Get Web2py Admin Password
if [ "$nopassword" -eq 0 ]
then
  echo -e "Web2py Admin Password: \c "
  read  PW
fi
# Upgrade and install needed software
apt-get update
apt-get -y upgrade
apt-get autoremove
apt-get autoclean
apt-get -y install nginx-full
apt-get -y install build-essential python-dev libxml2-dev python-pip unzip
pip install setuptools --no-use-wheel --upgrade
PIPPATH=`which pip`
$PIPPATH install --upgrade uwsgi
# Create common nginx sections
mkdir /etc/nginx/conf.d/web2py
echo '
gzip_static on;
gzip_http_version   1.1;
gzip_proxiedexpired no-cache no-store private auth;
gzip_disable"MSIE [1-6]\.";
gzip_vary   on;
' > /etc/nginx/conf.d/web2py/gzip_static.conf
echo '
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript 
text/xml application/xml application/xml+rss text/javascript;
' > /etc/nginx/conf.d/web2py/gzip.conf
# Create configuration file /etc/nginx/sites-available/web2py
echo '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 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;
}
###

###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 / {
#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 TLSv1 TLSv1.1 TLSv1.2;
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;
###
}
###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 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;
}
###

}' >/etc/nginx/sites-available/web2py

ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/web2py
rm 

[web2py] Re: Web2py with ngix

2016-12-08 Thread Mirek Zvolský
And this is the third file:

-rw-r--r-- 1 root root /etc/systemd/system/emperor.uwsgi.service

[Unit]
Description = uWSGI Emperor
After = syslog.target

[Service]
ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
RuntimeDirectory = uwsgi
Restart = always
KillSignal = SIGQUIT
Type = notify
StandardError = syslog
NotifyAccess = all

[Install]
WantedBy = multi-user.target

... I hope it is complete now...

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

2016-12-08 Thread Mirek Zvolský
On my working machine (Debian 8 Testing (systemd), nginx)
I have installed with the script
https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

but there was some problem or some missing code which I have found 
somewhere here in user group.

I am not sure if last version of the script at github.com/web2py/web2py 
works,

but maybe my files could help you:

-rw-r--r-- root root /etc/init/uwsgi-emperor.conf

description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [06]
##
#remove the comments in the next section to enable static file compression 
for the welcome app
#in that case, turn on gzip_static on; on /etc/nginx/nginx.conf
##
#pre-start script
#python /home/www-data/web2py/web2py.py -S welcome -R 
scripts/zip_static_files.py
#chown -R www-data:www-data /home/www-data/web2py/*
#end script
respawn
exec uwsgi --master --die-on-term --emperor /etc/uwsgi --logto 
/var/log/uwsgi/uwsgi.log

-rw-r--r-- root root /etc/uwsgi/web2py.ini

[uwsgi]

socket = /tmp/web2py.socket
pythonpath = /home/www-data/web2py/
mount = /=wsgihandler:application
processes = 4
master = true
harakiri = 60
reload-mercy = 8
cpu-affinity = 1
stats = /tmp/stats.socket
max-requests = 2000
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
uid = www-data
gid = www-data
touch-reload = /home/www-data/web2py/routes.py
cron = 0 0 -1 -1 -1 python /home/www-data/web2py/web2py.py -Q -S welcome -M 
-R scripts/sessions2trash.py -A -o
no-orphans = true

Previous works and I made no my own changes inside. It is just from the 
Web2py nginx/ubuntu script and from some post in this user group.

I control the servise so:
systemctl start emperor.uwsgi # stop,restart,status,...








On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>
> Web2py with ngix start work well.
> But when i start uwsgi 
> it show  uwsgi.service not found error.
> If i need to create service i don't know how to create.
> I follow this way
>
> https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>

-- 
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] Scheduler - no workers working...

2016-12-08 Thread António Ramos
hello i have a scheduler set up and then in the console i wrote

python web2py.py -K myapp

no error so far but it does not do anything...

db.scheduler_worker is empty and i have it running for 3 days now...


Any ideas?

regards
António

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