[web2py] Re: Slider example

2022-08-31 Thread Alex Beskopilny
unfortunately, I don't have the code.

I once made such a form from a book
web2py Application Development Cookbook
(I remember that there were errors in the book, 
but the code that came with the book worked 
after obvious changes)

On Tuesday, August 30, 2022 at 11:04:41 AM UTC+3 Kenneth wrote:

> Hello everybody,
>
> does anyone have an example on creating a form with sliders. Selecting a 
> value of lets say 1-10. 
>
> I tried using the example on web2pyslices but can't get it working. 
>
>
> Kenneth
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1bfdda50-729f-4e56-b685-8de17a635d1cn%40googlegroups.com.


[web2py] Re: rendering rows as a generator and displaying via SQLTABLE

2020-12-24 Thread Alex Beskopilny
Hi! 

You can create a table in memory and use grid
working example:

def pro_report1():
# https://web2py.wordpress.com/category/web2py-and-databases/
# 
https://stackoverflow.com/questions/33674532/web2py-sqlform-grid-with-executesql
tbl = 'proverka'

#f_short_proverka = [  'f' + str(e) for e in short_proverka ]

l = [e for e in db[tbl].fields if e in f_short_proverka ]
memf = [ Field('oid', 'integer', label='П id', default= 0) ] + \
   [ Field(db[tbl][e].name, db[tbl][e].type, label = 
db[tbl][e].label,
 length= db[tbl][e].length, represent= db[tbl][e].represent  )
 for e in l ]

dbmem = DAL('sqlite:memory')
dbmem.define_table('mem_table',*memf)

records = db(db[tbl].id>0).select().as_list()
for r in records:
r['oid'] = r['id']
dbmem.mem_table.insert(**dbmem.mem_table._filter_fields(r))

#dbmem.commit()

flds= [ db[tbl][e] for e in f_short_proverka ]
rows=db(db[tbl].id>0 ).select( *flds  )

exportclasses=dict(
csv_with_hidden_cols=False,
csv=False,
xml=False,
json=False,
tsv_with_hidden_cols=False,
tsv= False,
)

dbmem.mem_table.id.readable = False
grid = SQLFORM.grid(dbmem.mem_table, create=False, editable=False, 
exportclasses= exportclasses,
deletable=False, buttons_placement = 'left', 
showbuttontext=False)
return dict(rows=rows, l=l, records=records, grid=grid)

On Thursday, December 24, 2020 at 12:32:51 AM UTC+3 Vlad wrote:

> I'm getting the rows as a result of the select:
> *rows = db(query).select(*fields)*
> and want to display as 
> *table = SQLTABLE(rows, _class='table')*
> but before displaying need to reformat based on field representation, so 
> rendering first: 
> *rendered_rows = rows.render()*
> now I simply want to display the rendered_rows, like this: 
> *table = SQLTABLE(rendered_rows, _class='table')* 
> which is impossible because rendered_rows is a generator. I can iterate 
> row by row, but don't know how to use it with SQLTABLE. 
>
> Is there an easy way to transform the generator into the format that 
> SQLTABLE understands? 
>  
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/23e730b8-6522-4400-b034-7f9b912c345an%40googlegroups.com.


[web2py] Re: How to pass variables to db.executesql?

2020-11-20 Thread Alex Beskopilny
myid = 10L
sql_str = "xxx  where id=%s;" % (str(myid))
db.executesql( sql_str )

examples:  https://web2py.wordpress.com/tag/db-executesql/

On Friday, November 20, 2020 at 7:56:07 AM UTC+3 alexg...@gmail.com wrote:

> for example 
>
> where mytable.id = someWeb2PyVariable
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1888eac3-dab9-4182-97a6-dc5bb3caa84fn%40googlegroups.com.


[web2py] Re: Dashboard library for Web2py performance/recommendation python vs. js

2020-11-18 Thread Alex Beskopilny
dasjboards for web2py https://github.com/ali96343/facew2p
dashboards  for py4web https://github.com/ali96343/facep4w
charts Highcharts.js 
On Tuesday, November 17, 2020 at 11:47:04 AM UTC+3 Jonsubs wrote:

> Hi everyone,
> I need to implement a dashboard and some charts in my webapp. And honestly 
> I'm a little bit lost and overwhelmed.
>
> From a Web2py perspective which is the best approach?
> a) a python based solution (e.g. plotly)
> b) a JS based solution
>
> My app is hosted in Pythonanywhere.
>
> Is there any recommended dashboard and chart library for web2py?
> Thanks, Jon.
>
>
> 
>  Libre 
> de virus. www.avast.com 
> 
>  
> <#m_-2958339010838646051_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b33a4e69-68f9-4607-aa3f-99f1f661fb34n%40googlegroups.com.


[web2py] Re: SQLFLORMGRID

2020-10-08 Thread Alex Beskopilny
maybe you could do this

def art_manage():

if  len(request.args) >= 2 and ('new' == request.args[0]):
   # some code
   return ' create '


records= SQLFORM.grid(query=db.t_art,maxtextlength = 
40,deletable=False,create=True, fields=[db.t_art.f_name, db.t_art.f_team, 
db.t_art.f_tit])
return dict(records=records)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0f266063-c05b-4edd-9a2e-b76a8144bc89o%40googlegroups.com.


[web2py] Re: Streaming pdf in a browser

2020-09-28 Thread Alex Beskopilny
1 create new app and mkdir docfiles in it

# models/db1.py
db.define_table( 'zurina',
  Field('jenka_fnm', requires=IS_NOT_EMPTY(), 
label='orig_file_name'  ),
  Field("fld",label="Remark", length=3500,),
  Field('new_image_file', requires=IS_NOT_EMPTY(), 
label='w2p_file_name'  ),
  )
# controllers/default.py

# -*- coding: utf-8 -*-

def error(message="auth ?!!!error!!!"):
session.flash = message
redirect(URL('index'))


def zurina():
import os

jenka_fnm=''
l_id = 0

new_image_file_path=''
# mkdir docfiles in app dir !
upfolder= os.path.join(request.folder, 'docfiles')

form=SQLFORM.factory( Field('new_image_file', 'upload',uploadfolder= 
upfolder, requires=IS_NOT_EMPTY(),
label='orig_file_name'  ),
  Field("fld", 'text', label="Remark:", requires = 
IS_NOT_EMPTY(error_message='emplty field is bad!') ),
  )

form.element('textarea[name=fld]')['_rows']='2'


if form.process().accepted:
  jenka_fnm = request.vars.new_image_file.filename # origin file 
name
  new_image_file_path = os.path.join(upfolder, 
form.vars.new_image_file)
  piece = dict( jenka_fnm = jenka_fnm, new_image_file = 
new_image_file_path  , fld = form.vars.fld  )
  l_id=db.zurina.insert(**db.zurina._filter_fields( piece  ))
  request.flash='Ok!!!'
  session.flash= 'ok! ok!'
  #redirect(URL('zurina_grid'))
elif form.errors:
response.flash = 'Please correct the error(s).'


return locals()

def doc2user():
import os
prn_id = request.args(0,cast=int)
task = db.zurina(prn_id) or error()
qu=db.zurina.id == prn_id
res= db(qu).select().first()
file_path = res.new_image_file
ext = os.path.splitext( res.jenka_fnm  )
with open(file_path, 'rb') as f:
file_text= f.read()

from gluon.contenttype import contenttype
tru_ext=''
if len(ext) and len(ext[1]):
  tru_ext = ext[1].lower()

if len(tru_ext) :
response.headers['Content-Type'] = contenttype(tru_ext)
else:
response.headers['Content-Type'] = 
contenttype('application/octet-stream')

if len(tru_ext) and  tru_ext.endswith(('pdf','jpeg', 'jpg', 'png', 
'bmp')):
  response.headers['Content-disposition'] = 'inline; 
filename=\"%s"' % ( res.jenka_fnm)
else:
  response.headers['Content-disposition'] = 'attachment; 
filename=\"%s"' % ( res.jenka_fnm)

#return "{}".format( file_path  )
return file_text

def zurina_grid():

  query = db.zurina.id > 0

  grid=SQLFORM.grid( query, maxtextlength=200,user_signature=False, 
csv=False, buttons_placement = 'left',
   orderby =~ db.zurina.id,

   links=[ lambda row: A('Save',_href=URL('doc2user',args=row.id),  
_class="btn btn-default" , _title="save file to disk"  ), ],

   deletable = True, create=False, 
editable=False,showbuttontext=False)
  return locals()
---
# views/default/zurina.html
{{extend 'layout.html'}}

{{=A('Go to grid',_href=URL('zurina_grid'),_class="btn btn-primary 
btn-space", _title="View files list")}}

{{=form}}
# -- views/default/zurina_grid.html
{{extend 'layout.html'}}
{{=grid}}




четверг, 24 сентября 2020 г., 17:54:53 UTC+3 пользователь 
lcham...@gmail.com написал:
>
> Hi,
> i have a controller with this :
> response.headers['Content-Disposition'] = 'inline; filename=%s' % 
> request.vars.filename   
>
> to force streaming the pdf file , and i do not why it does not work ..
> any idea ?
>
> Thank you 
>
>  
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/08b25ff4-796b-4495-9215-b99a86182eb9o%40googlegroups.com.


[web2py] Re: Streaming pdf in a browser

2020-09-28 Thread Alex Beskopilny

it's work with web2py
inline for pdf, jpeg, png ...
save file fot other file types

def doc2user():
  
# read from db.table orig file name and path to file in upfolder
import os
prn_id = request.args(0,cast=int)
task = db.zurina(prn_id) or error()
qu=db.zurina.id == prn_id
res= db(qu).select().first()
upfolder= os.path.join(request.folder, 'docfiles')
   
#  path to file content
file_path = os.path.join( upfolder, res.new_image_file)
 
# orig file name 
ext = os.path.splitext( res.jenka_fnm  )
with open(file_path, 'rb') as f:
file_text= f.read()

from gluon.contenttype import contenttype
tru_ext=''
if len(ext) and len(ext[1]):
  tru_ext = ext[1].lower()

if len(tru_ext) :
response.headers['Content-Type'] = contenttype(tru_ext)
else:
response.headers['Content-Type'] = 
contenttype('application/octet-stream')

if len(tru_ext) and  tru_ext.endswith(('pdf','jpeg', 'jpg', 'png', 
'bmp')):
  response.headers['Content-disposition'] = 'inline; 
filename=\"%s"' % ( res.jenka_fnm)
else:
  response.headers['Content-disposition'] = 'attachment; 
filename=\"%s"' % ( res.jenka_fnm)

   # some debug string, you can view it in browser
#return "{}".format( file_path  )
return file_text

Also, we need the quotes   'attachment; filename=\"%s"' % ( res.jenka_fnm)

^^^

четверг, 24 сентября 2020 г., 17:54:53 UTC+3 пользователь 
lcham...@gmail.com написал:
>
> Hi,
> i have a controller with this :
> response.headers['Content-Disposition'] = 'inline; filename=%s' % 
> request.vars.filename   
>
> to force streaming the pdf file , and i do not why it does not work ..
> any idea ?
>
> Thank you 
>
>  
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7db8b3d8-b6e0-4759-ab52-6491b229e0b6o%40googlegroups.com.


[web2py] Re: Streaming pdf in a browser

2020-09-25 Thread Alex Beskopilny
only pdf to browser - inline

def doc2user():
import os
prn_id = request.args(0,cast=int)
task = db.zurina(prn_id) or error()
qu=db.zurina.id == prn_id
res= db(qu).select().first()
upfolder= os.path.join(request.folder, 'docfiles')
file_path = os.path.join( upfolder, res.new_image_file)
ext = os.path.splitext( res.jenka_fnm  )
with open(file_path, 'rb') as f:
file_text= f.read()

from gluon.contenttype import contenttype

if len(ext) and len(ext[1]):
response.headers['Content-Type'] = contenttype(ext[1])
else:
response.headers['Content-Type'] = 
contenttype('application/octet-stream')

if len(ext) and len(ext[1]) and ext[1].endswith('pdf'):

  response.headers['Content-disposition'] = 'inline; 
filename=\"%s"' % ( res.jenka_fnm)
else:
  response.headers['Content-disposition'] = 'attachment; 
filename=\"%s"' % ( res.jenka_fnm)



четверг, 24 сентября 2020 г., 17:54:53 UTC+3 пользователь 
lcham...@gmail.com написал:
>
> Hi,
> i have a controller with this :
> response.headers['Content-Disposition'] = 'inline; filename=%s' % 
> request.vars.filename   
>
> to force streaming the pdf file , and i do not why it does not work ..
> any idea ?
>
> Thank you 
>
>  
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f388deff-6ab2-42ab-91a4-08ae69a7828co%40googlegroups.com.


[web2py] Re: Streaming pdf in a browser

2020-09-25 Thread Alex Beskopilny
Hi! 
solution
 
https://stackoverflow.com/questions/20508788/do-i-need-content-type-application-octet-stream-for-file-download

web2py func
 
def doc2user():
import os
prn_id = request.args(0,cast=int)
task = db.zurina(prn_id) or error()
qu=db.zurina.id == prn_id
res= db(qu).select().first()
upfolder= os.path.join(request.folder, 'docfiles')
file_path = os.path.join( upfolder, res.new_image_file)
ext = os.path.splitext( res.jenka_fnm  )
with open(file_path, 'rb') as f:
file_text= f.read()

from gluon.contenttype import contenttype

if len(ext) and len(ext[1]):
response.headers['Content-Type'] = contenttype(ext[1])
else:
response.headers['Content-Type'] = 
contenttype('application/octet-stream')
response.headers['Content-disposition'] = 'attachment; filename=\"%s"' 
% ( res.jenka_fnm)

return file_text


четверг, 24 сентября 2020 г., 17:54:53 UTC+3 пользователь 
lcham...@gmail.com написал:
>
> Hi,
> i have a controller with this :
> response.headers['Content-Disposition'] = 'inline; filename=%s' % 
> request.vars.filename   
>
> to force streaming the pdf file , and i do not why it does not work ..
> any idea ?
>
> Thank you 
>
>  
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/06ba613b-9d45-4767-9a47-d76362406579o%40googlegroups.com.


[web2py] Re: How to sort a smartgrid with your own custom sorted id list

2020-07-03 Thread Alex Beskopilny
smartgrid sort with three one to many tables

def uvidomlen_all():
table=db.operacia

gqu = lambda tnm : (tnm.id>0) if auth.user.is_admin else 
(tnm.created_by == me)
oqu = lambda tnm : ~db[tnm].id

constraints = {'operacia':gqu(db.operacia), 'os1doc':gqu(db.os1doc), 
'os2doc':gqu(db.os2doc), 'os3doc':gqu(db.os3doc)}
orderby = {'operacia':oqu('operacia'), 'os1doc':oqu('os1doc'), 
'os2doc':oqu('os2doc'), 'os3doc':oqu('os3doc')}

return dict(grid=SQLFORM.smartgrid(db.operacia,
   deletable = False, #constraints = dict(povidomlen=query),
   editable = auth.user.is_admin,
   orderby= orderby,
   constraints= constraints,
   linked_tables= ['os1doc','os2doc','os3doc'] ,
   buttons_placement = 'left', 
user_signature=False,searchable=True, create=False, 
csv=False,showbuttontext=False,   ))


четверг, 18 июня 2020 г., 18:38:39 UTC+3 пользователь rāma написал:
>
> Hi all,
>
> How to sort a smartgrid with your own custom sorted id list?
>
> Say I have a id list after executing the query and I have a sorting 
> functions that returns a sorted id list, how would I make smartgrid to 
> commit to the ordering instead of sorting by ids by default?
>
> Thanks,
> rama
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/100b80be-4842-4bab-96c0-c00df0d75349o%40googlegroups.com.


[web2py] Re: How to sort a smartgrid with your own custom sorted id list

2020-07-03 Thread Alex Beskopilny
 Hi! 
some working solution

1 build a sqlite-table in memory, as required
2 insert data in the table
3 show table in smartgird

def pro_report1():

tbl = 'proverka'
l = [e for e in db[tbl].fields if e in f_short_proverka ]
memf = [ Field('oid', 'integer', label='П id', default= 0) ] + \
   [ Field(db[tbl][e].name, db[tbl][e].type, label = 
db[tbl][e].label,
 length= db[tbl][e].length, represent= db[tbl][e].represent  )
 for e in l ]

dbmem = DAL('sqlite:memory')
dbmem.define_table('mem_table',*memf)

records = db(db[tbl].id>0).select().as_list()
for r in records:
r['oid'] = r['id']
dbmem.mem_table.insert(**dbmem.mem_table._filter_fields(r))
flds= [ db[tbl][e] for e in f_short_proverka ]
rows=db(db[tbl].id>0 ).select( *flds  )

exportclasses=dict(
csv_with_hidden_cols=False,
csv=False,
xml=False,
json=False,
tsv_with_hidden_cols=False,
tsv= False,
)

dbmem.mem_table.id.readable = False
grid = SQLFORM.grid(dbmem.mem_table, create=False, editable=False, 
exportclasses= exportclasses,
deletable=False, buttons_placement = 'left', 
showbuttontext=False)
return dict(rows=rows, l=l, records=records, grid=grid)


четверг, 18 июня 2020 г., 18:38:39 UTC+3 пользователь rāma написал:
>
> Hi all,
>
> How to sort a smartgrid with your own custom sorted id list?
>
> Say I have a id list after executing the query and I have a sorting 
> functions that returns a sorted id list, how would I make smartgrid to 
> commit to the ordering instead of sorting by ids by default?
>
> Thanks,
> rama
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/63853b58-756c-4623-be23-1fd0872a08f3o%40googlegroups.com.


[web2py] Re: Standard way of removing X-Powered-By: web2py http header?

2020-04-12 Thread Alex Beskopilny
cd web2py/gluon
grep -r X-Powered-By
./globals.py:self.headers['X-Powered-By'] = 'xping'


воскресенье, 12 апреля 2020 г., 16:02:13 UTC+3 пользователь Yan Wong 
написал:
>
> I'm a bit disappointed that web2py by default sets `X-Powered-By: web2py` 
> in the http header, thus making it easier for web-scanning tools to detect 
> the software running behind a web site, and allow more targetted attacks. 
> Is there an easy config option to efficiently turn this off for all pages / 
> json responses etc served by web2py? Also, are there other ways to obscure 
> the fact that it is web2py / python running on a web server, and reduce 
> information disclosure? For example, can anyone detect what python version 
> I'm running by using web queries: I see that rocket server puts the python 
> version in the `Server:` header, which seems bad to me, although my 
> production machine simply returns `Server: nginx` which is a little better, 
> I suppose. I suspect it will never be possible to obscure the software 
> entirely, but anything that makes it harder for the script kiddies seems 
> like an easy win to 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/568d754e-316b-4cfb-abba-312bd83d549f%40googlegroups.com.


[web2py] Re: Web2py, react, typescript, visual studio code setup

2020-03-13 Thread Alex Beskopilny

Thanks Larry!  great example.

maybe in  *webpack.config.js*

*- app: './static/reactsrc/index.tsx'*
+ app: './static/src/index.tsx'

среда, 11 марта 2020 г., 18:59:40 UTC+3 пользователь Larry Weinberg написал:
>
> Several people have asked about how to set up web2py to work with React 
> (and Typescript) on the front end. Others have asked how to use an IDE like 
> Visual Studio Code with web2py. I have a setup that I've posted to github 
> that has the basics in place for doing this with a pre-configured Visual 
> Studio Code workspace and instructions on how to get it up and running.  
>  Web2py running inside VSCode is really easy to work with and debug!
>
> https://github.com/larrywberg/web2py-react-ts-vscode
>
> I am not an expert on Visual Studio Code, or React, or Typescript, or 
> web2py so I would be happy to get feedback to improve it.  I hope this is 
> useful for others.  It is using React with React Hooks for state 
> management.  There is a sample REST call set up.
>
> I hooked in a webpack dev server in addition to the web2py server so that 
> the react sample code can be iterated on quickly if you so choose.  You can 
> debug the python server and the Typescript client at the same time in 
> VSCode if you launch them both from the preconfigured launch tasks. You can 
> also use the Web2py admin interface to edit files in parallel with editing 
> them in VS Code when running locally.  There are other preconfigured 
> scripts set up and you can also trigger the compile of the react code from 
> a menu item in the sample 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/84d8d415-944f-46d9-aa8f-aa90d9c311ff%40googlegroups.com.


[web2py] Re: About menu and current page

2020-03-04 Thread Alex Beskopilny
items_sub_menu= []
menu_item = [ (chr( 0x0001f534 ), False, URL('default', 'index'), 
items_sub_menu) ]

save_orig_menu= response.menu
response.menu = menu_item
response.menu += save_orig_menu
items_sub_menu.append( (T('home'), False, URL(_app, 'default', 'index') ),)
items_sub_menu.append( (T('appadmin'), False, URL(_app, 'appadmin', 
'index') ),)


items_sub_menu.append( (T('ctrlnm1'), False, URL('ctrlnm1','index') ), )

items_sub_menu.append( (T('ctrlnm2'), False, URL('ctrlnm2','index') ), )


среда, 4 марта 2020 г., 14:13:26 UTC+3 пользователь Константин Комков 
написал:
>
> Hello, are somebody know how create link in menu empty if current page 
> like link in menu, but not empty if page is not like in link.
> I do like that:
>
> response.menu.insert(0, (T('Editor'), False, '#', [
> (T('Edit timetable'), False, '#' if (request.controller == 'default' and 
> request.function == 'selectTimetable') else URL('default', 
> 'selectTimetable')),
> ]))
>
> If there is more elegant way share it please.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b313a0e9-0f17-4850-a82b-7cb69246b492%40googlegroups.com.


[web2py] Re: Searching by date using SQLFORM.factory

2020-02-19 Thread Alex Beskopilny
import cPickle, os
def put_on_disk(file_name, data):

uploadfolder=os.path.join(request.folder, 'uploads')
fn = os.path.join(uploadfolder, file_name)
out_file = open(fn, 'w')
cPickle.dump(data, out_file)
out_file.close()


def get_from_disk(file_name):

uploadfolder=os.path.join(request.folder, 'uploads')
fn = os.path.join(uploadfolder, file_name)
in_file = open(fn, 'r')
data = cPickle.load(in_file)
in_file .close()
return data

save data on disk, add user.id to file name


четверг, 20 февраля 2020 г., 0:49:11 UTC+3 пользователь mostwanted написал:
>
> I'm trying to use SQLFORM.factory to search by date but its failing, it is 
> somehow possible to that & i'm missing something?? If so where can i 
> rectify my code to give me results?
>
> *MY FUNCTION*
> def search():
> form=SQLFORM.factory(Field('SEARCH', 'date')
> if form.accepts(request):
> tokens=form.vars.SEARCH.split()
> query=reduce(lambda a,b:a&b, [db.birthdays.contains(k) for k in 
> tokens])
> people=db(query).select(orderby=db.birthdays.Person)
> else:
> people=[]
> return locals()
>
> Regards;
>
> Mostwanted
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/24aed2dc-75c6-49e3-b6b5-b8b1cf5603bf%40googlegroups.com.


[web2py] py4web Form customization

2020-02-12 Thread Alex Beskopilny
is that possible? 

similar to the web2py

{{=form.custom.begin}}Name: 
{{=form.custom.widget.name}}{{=form.custom.submit}}{{=form.custom.end}}

 form.element('input[name=name]')['_id']='myid'
 form.element('input[name=name]')['_class']='myclass'


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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/12c5163a-651d-4761-900a-70e9edc80fb7%40googlegroups.com.


[web2py] Re: py4web nw version and new example

2020-02-10 Thread Alex Beskopilny

[X] loaded _dashboard
[FAILED] loading myfeed
..
FileNotFoundError: [Errno 2] No such file or directory: 
'apps/myfeed/databases/sql.log'

-
mkdir apps/myfeed/databases

and restart

понедельник, 10 февраля 2020 г., 9:13:46 UTC+3 пользователь Massimo Di 
Pierro написал:
>
> A new py4web version is out 0.1.20200209.2:
>
> - better reload mechanism should avoid come pitfalls and inconsistent state
> - includes a new example app, a minimalist facebook clone called myfeed 
> (feel free to suggest improvements)
> - includes a new page "/_dashboard/gitlog/{app_name}" which, for apps that 
> are git projects, allow to check commit history, checkout a commit, and 
> show commits. It is designed more as an educational tool and not as a 
> replacement of normal git commands. Needs documentation.
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/736eac61-c620-4232-9d3a-b723c4724926%40googlegroups.com.


[web2py] Re: SQLFORMGRID - CSS - LAYOUT

2019-12-07 Thread Alex Beskopilny
Hi! 
Here is the script and working examples for sqlform and customform
https://github.com/ali96343/facew2p
http://alibsk.pythonanywhere.com


среда, 4 декабря 2019 г., 18:47:26 UTC+3 пользователь L c написал:
>
> Hi,
> Soory but i do not find answer:
>
> I did that  :
>
>1. Create a subfolder of static (example "css_template")
>2. Move template files to static/css_template
>3. Move static/css_template/index.html to views/layout.html
>4. Edit views/layout.html to fix *href* and *src* to static files 
>using {{=URL('static','css_template/style.css')}}
>5. add these to views/layout.html where you want them to appear
>
> I have created a static html page with css like  ( href="../static/css_template/assets/css/main.css" />)
> inside this page html i have {{=list}}  (From controler : list= 
> SQLFORM.grid(query=query,maxtextlength=20,orderby=~db.t_news.id
> ,deletable=False,editable=False,create=False,advanced_search=False,csv=False)
>
> When i want to edit a record , the css ... are not taken ! where can i 
> change this ?
>
> thank you
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a007f400-bcfc-4177-89bf-cded5cf60056%40googlegroups.com.


[web2py] Re: How to easily implement another CSS-Framework

2019-10-14 Thread Alex Beskopilny
1:
views/default/myindex.html


Mysite


  myown unique  page with my_css
{{=message}}



2:
def index():
response.view = 'default/myindex.html'
return dict(message=T('Welcome to web2py!'))


пятница, 11 октября 2019 г., 8:38:52 UTC+3 пользователь Jay B написал:
>
> Hello guys,
>
> I'm trying to figure out how to include another CSS framework instead of 
> bootstrap. But the fact that the layout.html and other files point to the 
> bootstrap files makes it harder than I thought. 
>
> I would like to test other CSS frameworks like Semantic UI or Bulma 
> instead of Bootstrap and wonder how to do it best. Or am I forced to delete 
> all CSS files and standard views?
>
> I would be happy if you could help me and thank you in advance for all the 
> tips.
>
> Greetz
> Jay
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f16e2867-0c61-48d4-b2ee-5dff0b731914%40googlegroups.com.


[web2py] Re: Vue2pyj - alternative web IDE

2019-09-30 Thread Alex Beskopilny


суббота, 11 мая 2019 г., 5:12:26 UTC+3 пользователь Val K написал:
>
> As result of experimenting with Rapydscript I want to present my 
> alternative web IDE for web2py, 
> (that could be easily ported to web3py as well)
> https://github.com/valq7711/vue2pyj
>
> Any feedback is appreciated
>
> 2) 
> def safe_read(fp):
> with open(fp, 'rb') as f:
>   ^^^
> ret = f.read()
> return to_str(ret)
>^^
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/546e44ad-cf84-4a7b-bf70-d56abac9d2e8%40googlegroups.com.


[web2py] Re: Vue2pyj - alternative web IDE

2019-09-30 Thread Alex Beskopilny


суббота, 11 мая 2019 г., 5:12:26 UTC+3 пользователь Val K написал:
>
> As result of experimenting with Rapydscript I want to present my 
> alternative web IDE for web2py, 
> (that could be easily ported to web3py as well)
> https://github.com/valq7711/vue2pyj
>
> Any feedback is appreciated
>

  Hi! 

very interesting program, thanks !

to run it on localhost with python 3.7.3 (web2py Version 
2.18.5-stable+timestamp.2019.04.08.04.22.03)
I added to the file  vue2pyj/modules/fs2json.py

two func:

def to_bytes(data, enc="utf8"):
if data is None:
return b""
if isinstance(data, str):
return bytes(data, enc)  # data.encode('utf8')
if isinstance(data, dict):
return dict(map(to_bytes, data.items()))
if isinstance(data, tuple):
return map(to_bytes, data)
if isinstance(data, list):
return list(map(to_bytes, data))
return data


def to_str(data, enc="utf8", err="strict"):  # bytes to str
if data is None:
return str("")
if isinstance(data, bytes):
return data.decode(enc, err)
if isinstance(data, dict):
return dict(map(to_str, data.items()))
if isinstance(data, tuple):
return map(to_str, data)
if isinstance(data, list):
return list(map(to_str, data))
return data

and was changed lines
1)
ctime = stat.st_ctime * 1000,
mtime = stat.st_mtime * 1000,
#ctime = long(stat.st_ctime * 1000),
#mtime = long(stat.st_mtime * 1000),
2)
ret = f.read()
return to_str(ret)
3)
content =  to_bytes( fdata.get('content', '') )
#content =  unicode.encode(fdata.get('content', ''), 'utf8')


vue2pyj works, unfortunately web2py reports

ERROR:Rocket.Errors.Thread-5:Traceback (most recent call last):

  File "/home/w3p/web2py/gluon/rocket.py", line 1288, in run
self.run_app(conn)

  File "/home/w3p/web2py/gluon/rocket.py", line 1781, in run_app
self.environ = environ = self.build_environ(sock_file, conn)

  File "/home/w3p/web2py/gluon/rocket.py", line 1601, in build_environ
request = self.read_request_line(sock_file)

  File "/home/w3p/web2py/gluon/rocket.py", line 1339, in read_request_line
d = sock_file.readline()

  File "/home/w3p/anaconda3/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)

ConnectionResetError: [Errno 104] Connection reset by peer

ERROR:Rocket.Errors.Thread-5:Tried to send "500 Server Error" to client but 
received socket error



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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d96bad10-4e57-4049-a6da-ac828a010649%40googlegroups.com.


[web2py] Re: py4web: how to import Template and change delimiters

2019-08-06 Thread Alex Beskopilny
it's port lte-2.4.15 to py4web

https://github.com/ali96343/lteadmin-py4web

четверг, 1 августа 2019 г., 10:48:02 UTC+3 пользователь Alex Beskopilny 
написал:
>
> Hi! 
> I put lte-2.4.15  to py4web  and lte works  with controllers.py :
>
> from py4web import action, request, abort, redirect, URL
> from yatl.helpers import A
> from . common import db, session, T, cache, auth
>
> @action('index')
> @action.uses('index.html', )
> #@action.uses(Template('index.html', delimiters='[[ ]]'))
> def index():
> message= "index.html"
> user= "first second third"
> return dict(message=message, user=user)
> ..
> but does not works with :
> from py4web import action, request, abort, redirect, URL , Template
>   
>  
> 
> error message:
> WARNING:tornado.access:404 GET /lte2 (127.0.0.1) 1.20ms
> WARNING:tornado.access:404 GET /lte2 (127.0.0.1) 1.55ms
> WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 1.45ms
>
> how to fix it ?
>
> Is it possible to use some characters for delimiters, 
> for example  delimiters='XXX ' ?
> what is limits for delimiters ?
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/340caf35-ba63-4255-a925-3be063ee7982%40googlegroups.com.


[web2py] Re: py4web: how to import Template and change delimiters

2019-08-01 Thread Alex Beskopilny

Thanks Massimo! 

it works: deliniters="X0X0X0 Y1Y1Y1"
and delimiters="[Z[ ]]"

py4web was tested with   urls  lte-2.14.15 
and ThreadPoolExecutor(max_workers=10)

results:
execution time: 98.3 sec, data_size=  3794965000, urls= 56000
 bytes/sec= 38596744.13, req/sec= 569.54




четверг, 1 августа 2019 г., 10:48:02 UTC+3 пользователь Alex Beskopilny 
написал:
>
> Hi! 
> I put lte-2.4.15  to py4web  and lte works  with controllers.py :
>
> from py4web import action, request, abort, redirect, URL
> from yatl.helpers import A
> from . common import db, session, T, cache, auth
>
> @action('index')
> @action.uses('index.html', )
> #@action.uses(Template('index.html', delimiters='[[ ]]'))
> def index():
> message= "index.html"
> user= "first second third"
> return dict(message=message, user=user)
> ..
> but does not works with :
> from py4web import action, request, abort, redirect, URL , Template
>   
>  
> 
> error message:
> WARNING:tornado.access:404 GET /lte2 (127.0.0.1) 1.20ms
> WARNING:tornado.access:404 GET /lte2 (127.0.0.1) 1.55ms
> WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 1.45ms
>
> how to fix it ?
>
> Is it possible to use some characters for delimiters, 
> for example  delimiters='XXX ' ?
> what is limits for delimiters ?
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/caaf1e92-773b-496c-9bf9-d87884d53ece%40googlegroups.com.


[web2py] py4web: how to import Template and change delimiters

2019-08-01 Thread Alex Beskopilny
Hi! 
I put lte-2.4.15  to py4web  and lte works  with controllers.py :

from py4web import action, request, abort, redirect, URL
from yatl.helpers import A
from . common import db, session, T, cache, auth

@action('index')
@action.uses('index.html', )
#@action.uses(Template('index.html', delimiters='[[ ]]'))
def index():
message= "index.html"
user= "first second third"
return dict(message=message, user=user)
..
but does not works with :
from py4web import action, request, abort, redirect, URL , Template

   

error message:
WARNING:tornado.access:404 GET /lte2 (127.0.0.1) 1.20ms
WARNING:tornado.access:404 GET /lte2 (127.0.0.1) 1.55ms
WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 1.45ms

how to fix it ?

Is it possible to use some characters for delimiters, 
for example  delimiters='XXX ' ?
what is limits for delimiters ?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1a809bdf-2659-42ef-a3ab-11350da79bbb%40googlegroups.com.


[web2py] Re: web2py multiple domains on nginx + gunicorn

2019-07-01 Thread Alex Beskopilny
 

start second guicorn 
You have to run your projects on different ports like firsrone on 8000 and 
secondone on 8001. Then in nginx conf, in place of location /, you have to 
write location /firstone/ and proxy pass this to port 8000 and then write 
same location object for second one as location /secondone/ and proxy pass 
it to port 8001.


some example 
http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/


понедельник, 1 июля 2019 г., 16:23:30 UTC+3 пользователь Áureo Dias Neto 
написал:
>
> Good morning group,
>
> I'm using web2py on nginx + gunicorn, I currently have two applications 
> with two different domains, one for each web2py application ..
>
> Each domain points to my ip in AWS and nginx, each domain has a file in 
> nginx with its settings and server_name corresponding to its domain with 
> location pointing to / web2py / applications
>
> My routes.py file follows the pattern:
>
> routers = dict (
> BASE = dict (
> domains = {
> 'exampleapp.com': 'exampleapp',
> 'anotherexample.com': 'anotherexample',
> }
> ),
> )
>
> however, whenever you access exampleapp.com or any other domain listed 
> there, I'm redirected to exampleapp.com/welcome
>
> I can only run an app with the following configuration in the routes.py 
> file
>
> routers = dict (
> BASE = dict (
> default_application = 'exampleapp',
> domains = {
> 'exampleapp.com': 'exampleapp',
> 'anotherexample.com': 'anotherexample',
> }
> ),
> )
>
> so both exampleapp.com and anotherexample.com redirect to exampleapp.
>
> How to proceed?
> Hugs
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/31ee98f9-04c9-48a5-966e-52ce19439fcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py multiple domains on nginx + gunicorn

2019-07-01 Thread Alex Beskopilny


понедельник, 1 июля 2019 г., 16:23:30 UTC+3 пользователь Áureo Dias Neto 
написал:
>
>
> .
>
for me works 
1 up second gunicorn
2  dom2.conf 
upstream gunidom2 { server unix:/home/w2p/var/guni-dom2.sock 
fail_timeout=0; }

server {

listen xx.yy.zz.ww:443 ssl http2;
 server_name dom2.ru;
 add_header Strict-Transport-Security "max-age=31536000; 
includeSubDomains";

  add_header Allow "GET, POST, HEAD, DELETE" always;
  if ( $request_method !~ ^(GET|POST|HEAD|DELETE)$ ) {
  return 444;
 }

ssl_certificate /etc/letsencrypt/live/dom2.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dom2.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/dom2.ru/chain.pem;

resolver 127.0.0.1 valid=86400 ipv6=off;

ssl on;

..
}
..
location / {

try_files $uri @proxy_to_gunidom2;
}

location @proxy_to_gunidom2 {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header Host  dom2.ru;
proxy_redirect off;

add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block;";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" 
always;

proxy_set_headerX-Forwarded-By
$server_addr:$server_port;
proxy_set_headerX-Forwarded-Proto $scheme;
proxy_set_headerX-Real-IP $remote_addr;


proxy_pass http://gunidom2;
 rewrite ^/$ /dom2 last;
}


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0e914b35-a6a1-49cb-adf4-1cd4b1ed41d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: is it possible to make social site like facebook/linkedin by web2py ?

2019-06-27 Thread Alex Beskopilny
Hi! imran tube

_only_ web2py ! 
download css-html-template and run app builder 
some demo 
https://alibsk.pythonanywhere.com/

четверг, 27 июня 2019 г., 6:08:54 UTC+3 пользователь imran tube написал:
>
> which  framework best for me django or web2py?
> web2py all demo site not work or old or unfinished...
>
> why you dont update or make tutorial like django?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6b6639e9-c0fc-41ea-9306-c67e8f13b9dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Upload files

2019-06-22 Thread Alex Beskopilny
if any ( ['.jpg' in file_name, '.JPG' in file_name ,  ]  ):
?

суббота, 22 июня 2019 г., 11:18:42 UTC+3 пользователь Константин Комков 
написал:
>
> I made upload form for files that winter and today when project is working 
> 3 days user told me that he can't load file. When I saw that file it name 
> was "name.JPG"  but in my code befor i find only .jpg. Now all is ok.
> for i in img:
> s = i.file[len(i.file)-5:len(i.file)]
> if ((s.find('.jpg')>-1) | (s.find('.JPG')>-1) | 
> (s.find('.jpeg')>-1) | (s.find('.JPEG')>-1) | (s.find('.png')>-1) | 
> (s.find('.PNG')>-1) | (s.find('.bmp')>-1) | (s.find('.BMP')>-1)):
> studDocs = studDocs + """ class="col col-pd"> src='"""+URL('bak','download',args=i.file)+"""'/> class='del-img'>"""
> elif ((s.find('.pdf')>-1) | (s.find('.PDF')>-1)):
> studDocs = studDocs + """ class="col col-pd">.pdf"""
> elif ((s.find('.tif')>-1) | (s.find('.TIF')>-1)):
> studDocs = studDocs + """ class="col col-pd">.tiff"""
>
> [image: uploadForm.png]
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bf36b82f-f998-4508-a20b-1b60bcdca909%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: css templates layouts for web2py

2019-05-11 Thread Alex Beskopilny
 

This is not a template generator. 
This is a template installer to web2py env.
Examples for some free admin dashboards in applications dir

четверг, 9 мая 2019 г., 21:25:00 UTC+3 пользователь Alex Beskopilny написал:

   Hi !
>
>https://github.com/ali96343/facew2p.git
>
>Here is a script that generates web2py application from css templates.
> The script generates layouts, form (from html tag ), tables (from 
> html tag ).
> The script has been tested on 50 templates.
>   
>Thanks and best regards,
> Alex Beskopilny
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/650f556f-6eb7-488d-a73f-ec5913801fc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] css templates layouts for web2py

2019-05-09 Thread Alex Beskopilny
   Hi !

   https://github.com/ali96343/facew2p.git

   Here is a script that generates web2py application from css templates.
The script generates layouts, form (from html tag ), tables (from 
html tag ).
The script has been tested on 50 templates.
  
   Thanks and best regards,
Alex Beskopilny


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6ec453d3-ae52-4ff3-aa5e-751f23854f25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: python2 and python3 in 1 machine

2018-05-18 Thread Alex Beskopilny
You are right , sym-link is simple example.

In multi-python multi-web2py envs I use to full path to python
(centos 7 /etc/systemd/syste/gunicorn.service)
---
[Unit]
Description=Gunicorn instance to serve web2py
After=network.target

[Service]
User=w2p
Group=w2p
WorkingDirectory=/home/w2p/web2py
#Environment="PATH=/home/w2p/.conda/envs/lic/bin/:$PATH"
#ExecStart=/home/w2p/.conda/envs/lic/bin/gunicorn --workers 24 --timeout=90 
--graceful-timeout=10 --bind 127.0.0.1:8005 wsgihandler:application
ExecStart=/home/w2p/.conda/envs/lic/bin/gunicorn --workers 20 --timeout=90 
--graceful-timeout=10 --reload --bind unix:/home/w2p/var/gunicorn.sock 
wsgihandler:application

Restart=always
[Install]
WantedBy=multi-user.target

--
/home/w2p/.conda/envs/lic/bin/gunicorn
---
#!/home/w2p/.conda/envs/lic/bin/python
if __name__ == '__main__':
import sys
from gunicorn.app.wsgiapp import run

sys.exit(run())

also, I use to pip with full path or with sym-link  

вторник, 8 мая 2018 г., 3:11:37 UTC+3 пользователь 黄祥 написал:
>
> plan to test web2py both python2 and python3 in 1 machine, any idea how to 
> do that in the safety way?
> already googling found this:
>
> brew update
> brew install python
> brew install python3
>
> any thought or comment?
>
> thx and best regards,
> stifan
>

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


[web2py] Re: python2 and python3 in 1 machine

2018-05-18 Thread Alex Beskopilny
you missed 
adduser pyuser
sudo su pyuser
:(





вторник, 8 мая 2018 г., 3:11:37 UTC+3 пользователь 黄祥 написал:
>
> plan to test web2py both python2 and python3 in 1 machine, any idea how to 
> do that in the safety way?
> already googling found this:
>
> brew update
> brew install python
> brew install python3
>
> any thought or comment?
>
> thx and best regards,
> stifan
>

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


[web2py] Re: python2 and python3 in 1 machine

2018-05-18 Thread Alex Beskopilny
use anaconda .

1 adduser  pyuser
2 su  pyuser
3 install anaconda  https://conda.io/miniconda.htmlto   ~/opt
4 conda create --name mypython3 python=3 
ln -s ~/.conda/envs/mypython3/bin/python3  ~/bin/mypy3

5 conda create --name mypython2 python=2 

  ln -s ~/.conda/envs/mypython2/bin/python2  ~/bin/mypy2

вторник, 8 мая 2018 г., 3:11:37 UTC+3 пользователь 黄祥 написал:
>
> plan to test web2py both python2 and python3 in 1 machine, any idea how to 
> do that in the safety way?
> already googling found this:
>
> brew update
> brew install python
> brew install python3
>
> any thought or comment?
>
> thx and best regards,
> stifan
>

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


[web2py] Re: FYI: A tutorial on how to customize export in SQLFORM.grid

2018-04-03 Thread Alex Beskopilny
Hi! 
exporter example

0 pip install xlwt 
1 at end of gluon/sqlhtml.py 

class ExporterXLS(ExportClass):
label = 'XLS'
file_ext = "xls"
content_type = ".xls"
# https://gist.github.com/brendano/22764
# https://groups.google.com/forum/#!topic/web2py/MR_8JzzP9o4
def __init__(self, rows):
ExportClass.__init__(self, rows)

def export(self):
import xlwt, cStringIO
if len(self.rows) == 0:
  return 'empty rows-table'

rows_colnames= [name.translate(None,'"') for name in 
self.rows.colnames ]

(table_name, _)= rows_colnames[0].split('.')
book = xlwt.Workbook()
sheet = book.add_sheet(table_name)
first_xls_row= 0
# rows.db.licence.fld2.represent(row.fld2,3)

def list2xls(row_num,line_list):
for col_num, value in enumerate(line_list):
 if value is None:
 value=''
 elif isinstance(value, long):
 value= str(value)
 elif isinstance(value, str):
 value= value.decode('utf8')
 elif isinstance(value,  datetime.date):
 value= value.strftime('%d.%m.%Y')
 elif isinstance(value, datetime.datetime):
 value= value.strftime('%d.%m.%Y %H:%M:%S')
 else:
 value=''
 sheet.write(row_num, col_num, value)

fields=[]; labels=[]
for col in rows_colnames:
(t,f) = col.split('.')
fields.append(f)
labels.append( self.rows.db[t][f].label )
list2xls(first_xls_row, labels)

for r_num, row in enumerate (self.rows, first_xls_row + 1):
 llist=[ row[f]  for f in fields]
 list2xls(r_num, llist)

s = cStringIO.StringIO()
book.save(s)
return s.getvalue()

2  gluon/sqlhtml.py 
2517 exportManager = dict(
2518 axls=(ExporterXLS, 'XLS', T('Excell file')), # myfix
2519 csv_with_hidden_cols=(ExporterCSV_hidden, 'CSV (hidden 
cols)', T('Comma-separated export including columns not shown; fields from 
other tables are exported as raw values  for faster export')),
...

3 it's work for me :)


воскресенье, 1 апреля 2018 г., 10:08:30 UTC+3 пользователь Ray (a.k.a. 
Iceberg) написал:
>
> Stumbled upon this blog post "Export in web2py's SQLFORM.grid 
> " by Prasad Muley. It provides 
> concrete example on how to customize an exporter TO REMOVE THE TABLE PREFIX 
> IN CSV HEADER LINE. That is easier to digest than the standard web2py 
> book's one-liner 
> 
>  
> "(exporters) are all defined in gluon/sqlhtml.py. Take a look at those for 
> creating your own exporter.".
>
> Hope that helps! Enjoy!
>
> Regards,
> Ray
>
>
>

-- 
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: compiling application ?

2018-03-02 Thread Alex Beskopilny
try this

cd /home/w2p/web2py
python -c "import gluon.compileapp; 
gluon.compileapp.compile_application('applications/myapp')"

# for using gzip compression with nginx
# 
https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-14-04
# replace in zip_static_files.py  print with print()
# python web2py.py -S myapp  -R scripts/zip_static_files.py | grep -v skip
cd -
---

среда, 28 февраля 2018 г., 2:26:10 UTC+3 пользователь Yoel Benitez Fonseca 
написал:
>
> Is there a way of compiling a web2py application from the command line ? 
>
> -- 
> Msc. Yoel Benítez Fonseca 
>

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


[web2py] Re: only static files forbidden on centos 7.4 apache 2.4

2018-02-14 Thread Alex Beskopilny
also, it's very useful sslh https://github.com/yrutschle/sslh
works fine with nginx

суббота, 10 февраля 2018 г., 17:11:43 UTC+3 пользователь lucas написал:
>
> hey all,
>
> setting up a new server on centos 7.4 and apache 2.4.  web2py is running 
> fine for i get the welcome content but none of the files under static are 
> coming down to the client. please makes suggestions.  thank you.
>
> lucas
>
> here is my default.conf file where you'll see i've tried a bunch of 
> options.  nothing worked so far.:
>
>
>
>
> NameVirtualHost *:80 
> NameVirtualHost *:443 
>
>
>  
> WSGIProcessGroup web2py 
> # WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
> WSGIPassAuthorization On 
>
>  
> AllowOverride None 
> Order Allow,Deny 
> Deny from all 
>  
> Require all granted 
> Allow from all 
>  
>  
>
> AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
> /opt/web-apps/web2py/applications/\$1/static/\$2 
> # AliasMatch ^/([^/]+)/static/(.*) 
> /opt/web-apps/web2py/applications/$1/static/$2 
>
>  
> # Options -Indexes 
> Order Allow,Deny 
> Allow from all 
> # Require all granted 
>  
>
>  
> Deny from all 
>  
>
>  
> Deny from all 
>  
>
> CustomLog /var/log/httpd/access_log common 
> ErrorLog /var/log/httpd/error_log 
>  
>
>  
> # SSLEngine on 
> # SSLCertificateFile /etc/httpd/ssl/self_signed.cert 
> # SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key 
>
> WSGIProcessGroup web2py 
> # WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
> WSGIPassAuthorization On 
>
>  
> AllowOverride None 
> Order Allow,Deny 
> Deny from all 
>  
> Require all granted 
> Allow from all 
>  
>  
>
> AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
> /opt/web-apps/web2py/applications/\$1/static/\$2 
> # AliasMatch ^/([^/]+)/static/(.*) 
> /opt/web-apps/web2py/applications/$1/static/$2 
>
>  
> # Options -Indexes 
> # ExpiresActive On 
> # ExpiresDefault "access plus 1 hour" 
> Order Allow,Deny 
> Allow from all 
> # Require all granted 
>  
>
> CustomLog /var/log/httpd/access_log common 
> ErrorLog /var/log/httpd/error_log 
> 
>

-- 
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: only static files forbidden on centos 7.4 apache 2.4

2018-02-14 Thread Alex Beskopilny
we use nginx with http2
rebuild nginx with http2 support on centos 7
-
export NXT_CC_NAME=gcc # default compiller for nginx

OPENSSL="openssl-1.0.2h" # ok with nginx-1.11.13-1
OPENSSL="openssl-1.1.0f" # ok with nginx-1.11.13-1
NGINX="nginx-1.11.13-1"
#NGINX="nginx-1.13.5-1"


mkdir -p /opt/lib
wget https://www.openssl.org/source/$OPENSSL.tar.gz -O 
/opt/lib/$OPENSSL.tar.gz
tar -zxvf /opt/lib/$OPENSSL.tar.gz -C /opt/lib

rpm -ivh 
http://nginx.org/packages/mainline/centos/7/SRPMS/$NGINX.el7.ngx.src.rpm
sed -i "s|--with-http_ssl_module|--with-http_ssl_module 
--with-openssl=/opt/lib/$OPENSSL --with-openssl-opt=-fPIC|g" 
/home/admin/rpmbuild/SPECS/nginx.spec
rpmbuild -ba /home/admin/rpmbuild/SPECS/nginx.spec

#rpm -Uvh 
/home/admin/rpmbuild/RPMS/x86_64/$NGINX.el7.centos.ngx.x86_64.rpm

install and add to /etc/yum.conf
exclude=nginx

суббота, 10 февраля 2018 г., 17:11:43 UTC+3 пользователь lucas написал:
>
> hey all,
>
> setting up a new server on centos 7.4 and apache 2.4.  web2py is running 
> fine for i get the welcome content but none of the files under static are 
> coming down to the client. please makes suggestions.  thank you.
>
> lucas
>
> here is my default.conf file where you'll see i've tried a bunch of 
> options.  nothing worked so far.:
>
>
>
>
> NameVirtualHost *:80 
> NameVirtualHost *:443 
>
>
>  
> WSGIProcessGroup web2py 
> # WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
> WSGIPassAuthorization On 
>
>  
> AllowOverride None 
> Order Allow,Deny 
> Deny from all 
>  
> Require all granted 
> Allow from all 
>  
>  
>
> AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
> /opt/web-apps/web2py/applications/\$1/static/\$2 
> # AliasMatch ^/([^/]+)/static/(.*) 
> /opt/web-apps/web2py/applications/$1/static/$2 
>
>  
> # Options -Indexes 
> Order Allow,Deny 
> Allow from all 
> # Require all granted 
>  
>
>  
> Deny from all 
>  
>
>  
> Deny from all 
>  
>
> CustomLog /var/log/httpd/access_log common 
> ErrorLog /var/log/httpd/error_log 
>  
>
>  
> # SSLEngine on 
> # SSLCertificateFile /etc/httpd/ssl/self_signed.cert 
> # SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key 
>
> WSGIProcessGroup web2py 
> # WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
> WSGIPassAuthorization On 
>
>  
> AllowOverride None 
> Order Allow,Deny 
> Deny from all 
>  
> Require all granted 
> Allow from all 
>  
>  
>
> AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
> /opt/web-apps/web2py/applications/\$1/static/\$2 
> # AliasMatch ^/([^/]+)/static/(.*) 
> /opt/web-apps/web2py/applications/$1/static/$2 
>
>  
> # Options -Indexes 
> # ExpiresActive On 
> # ExpiresDefault "access plus 1 hour" 
> Order Allow,Deny 
> Allow from all 
> # Require all granted 
>  
>
> CustomLog /var/log/httpd/access_log common 
> ErrorLog /var/log/httpd/error_log 
> 
>

-- 
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: only static files forbidden on centos 7.4 apache 2.4

2018-02-13 Thread Alex Beskopilny
nginx much better :)
simple setup -
https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-centos-7



суббота, 10 февраля 2018 г., 17:11:43 UTC+3 пользователь lucas написал:
>
> hey all,
>
> setting up a new server on centos 7.4 and apache 2.4.  web2py is running 
> fine for i get the welcome content but none of the files under static are 
> coming down to the client. please makes suggestions.  thank you.
>
> lucas
>
> here is my default.conf file where you'll see i've tried a bunch of 
> options.  nothing worked so far.:
>
>
>
>
> NameVirtualHost *:80 
> NameVirtualHost *:443 
>
>
>  
> WSGIProcessGroup web2py 
> # WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
> WSGIPassAuthorization On 
>
>  
> AllowOverride None 
> Order Allow,Deny 
> Deny from all 
>  
> Require all granted 
> Allow from all 
>  
>  
>
> AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
> /opt/web-apps/web2py/applications/\$1/static/\$2 
> # AliasMatch ^/([^/]+)/static/(.*) 
> /opt/web-apps/web2py/applications/$1/static/$2 
>
>  
> # Options -Indexes 
> Order Allow,Deny 
> Allow from all 
> # Require all granted 
>  
>
>  
> Deny from all 
>  
>
>  
> Deny from all 
>  
>
> CustomLog /var/log/httpd/access_log common 
> ErrorLog /var/log/httpd/error_log 
>  
>
>  
> # SSLEngine on 
> # SSLCertificateFile /etc/httpd/ssl/self_signed.cert 
> # SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key 
>
> WSGIProcessGroup web2py 
> # WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
> WSGIPassAuthorization On 
>
>  
> AllowOverride None 
> Order Allow,Deny 
> Deny from all 
>  
> Require all granted 
> Allow from all 
>  
>  
>
> AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
> /opt/web-apps/web2py/applications/\$1/static/\$2 
> # AliasMatch ^/([^/]+)/static/(.*) 
> /opt/web-apps/web2py/applications/$1/static/$2 
>
>  
> # Options -Indexes 
> # ExpiresActive On 
> # ExpiresDefault "access plus 1 hour" 
> Order Allow,Deny 
> Allow from all 
> # Require all granted 
>  
>
> CustomLog /var/log/httpd/access_log common 
> ErrorLog /var/log/httpd/error_log 
> 
>

-- 
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: Resetting the database

2018-01-29 Thread Alex Beskopilny
truncate with foreign-key depends on DB.

for postgresql   : 
def clear_tbls():
str1 = ','.join(  [ t  for t in db.tables() if "auth_" not in t]   )
if len(str1):
 db.executesql( 'truncate {} RESTART IDENTITY'.format(str1)  )


понедельник, 14 ноября 2011 г., 3:38:15 UTC+3 пользователь Archibald Linx 
написал:
>
> Dear Web2py users, 
>
> How can I reset the database of my Web2py project ? 
>
> Thanks, 
> Archibald

-- 
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: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

2018-01-15 Thread Alex Beskopilny
use encode () decode() for utf8 message 
 example:

1 
 def cyr2upper(inp,up=True):

if len(inp) > STR_LEN_LIMIT:
inp= inp[:STR_LEN_LIMIT]
try:
inp=inp.decode('utf8')
except UnicodeDecodeError, e:
inp=u'Уточните данные , плс, :)'

symbols = (u"абвгдеёжзийклмнопрстуфхцчшщъыьэюя",
   u"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ")

if up == True:
tr = {ord(a): ord(b) for a, b in zip(*symbols)}
else:
tr = {ord(a): ord(b) for b, a in zip(*symbols)}
return inp.translate(tr).encode('utf8')

2 def fld2lower(x):
return " 
".join(x.split()).decode('utf8','ignore').lower().encode('utf8','ignore')

https://habrahabr.ru/post/135913/

пятница, 5 января 2018 г., 22:41:19 UTC+3 пользователь Alexey Zaytsev 
написал:
>
>
> 
>
>
>
> 
>
>
> 
>
>
>
> 
>
>
>
> *?*
>
>
>
>

-- 
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: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

2018-01-14 Thread Alex Beskopilny
we can set page encoding in 
models/db.py

T.force('ru')

if request.env.wsgi_url_scheme in ['https', 'HTTPS']:
session.secure()
...
пятница, 5 января 2018 г., 22:41:19 UTC+3 пользователь Alexey Zaytsev 
написал:
>
>
> 
>
>
>
> 
>
>
> 
>
>
>
> 
>
>
>
> *?*
>
>
>
>

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

2018-01-09 Thread Alex Beskopilny
small fix - use dockerDNS
1
# run.sh
docker rm $(docker stop $(docker ps -a -q --filter ancestor=w2pnginx 
--format="{{.ID}}"))
docker rm $(docker stop $(docker ps -a -q --filter ancestor=w2pguni 
--format="{{.ID}}"))
docker network rm w2pnet


docker network create --subnet=172.25.0.0/16 w2pnet

docker build -t w2pguni -f guniDoc .
docker run -d --net w2pnet -p 9005:9005 --name w2pname  --ip 172.25.0.22   
w2pguni
# docker exec -it w2pname  bash

sleep 2
ping -c1 -n 172.25.0.22
docker run --net w2pnet busybox ping -c1 -n w2pname
echo "--"
curl -I 172.25.0.22:9005

docker build -t w2pnginx -f nginxDoc .
docker run -d --net w2pnet --name nginxname --ip 172.25.0.23  w2pnginx
# docker exec -it nginxname  bash

sleep 2
ping -c1 -n 172.25.0.23
docker run --net w2pnet busybox ping -c1 -n nginxname
echo "--"
curl -I 172.25.0.23

docker ps
docker network ls
docker network inspect w2pnet

2
#w2p.conf
upstream gunicorn {
server  w2pname:9005 fail_timeout=0;
}

server {
listennginxname:80 default_server;
#listen172.25.0.23:80 default_server;

location / {
try_files $uri @proxy_to_gunicorn;
}

location @proxy_to_gunicorn {
 proxy_set_header X-Real-IP $remote_addr;
 proxy_redirect off;
 proxy_set_header Host $host;
proxy_pass http://gunicorn;
}

}



On Friday, January 5, 2018 at 5:45:04 AM UTC+3, 黄祥 wrote:
>
> just wondering why gunicorn dockerfile with web2py/anyserver.py is not 
> work when use with python:2.7 image
> e.g.
> *step i took*
> cat < Dockerfile
> FROM python:2.7
> RUN apt update && \
>  apt install -y unzip wget gunicorn
> RUN groupadd -r web2py && \
>  useradd -m -r -g web2py web2py
> USER web2py
> RUN cd /home/web2py/ && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/web2py/web2py/applications/examples && \
>  chmod 755 -R /home/web2py/web2py
> EXPOSE 80
> CMD cd ~ && python /home/web2py/web2py/anyserver.py -s gunicorn -i 0.0.0.0 
> -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> *result*
> starting gunicorn on 0.0.0.0:80...
> Traceback (most recent call last):
>   File "/home/web2py/web2py/anyserver.py", line 365, in 
> main()
>   File "/home/web2py/web2py/anyserver.py", line 362, in main
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 314, in run
> getattr(Servers, servername)(application, (ip, int(port)), 
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 137, in gunicorn
> from gunicorn.app.base import Application
> ImportError: No module named gunicorn.app.base
>
> but it works well when using ubuntu latest image
> *e.g.*
> *step i took*
> cat < Dockerfile
> FROM ubuntu:latest
> RUN apt update && \
>  apt install -y python python-pip python-setuptools unzip vim wget 
> gunicorn && \
>  pip install --upgrade pip && \
>  pip install virtualenv && \
>  virtualenv /home/site && \
>  rm -rf /home/site/web2py && \
>  cd /home/site/ && \
>  rm -f web2py_src.zip && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/site/web2py/applications/examples && \
>  chmod 755 -R /home/site/web2py
> EXPOSE 80 
> CMD . /home/site/bin/activate && /usr/bin/python 
> /home/site/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> all tested in https://labs.play-with-docker.com
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: web2py gunicorn dockerfile

2018-01-09 Thread Alex Beskopilny
four files in same directory
1 
#guniDoc
FROM python:2.7

RUN apt update && apt install -y unzip wget
ENV PATH=/usr/local/bin:$PATH
RUN pip install gunicorn

RUN useradd -m -r  web2py
USER web2py
WORKDIR /home/web2py
RUN  wget -c http://web2py.com/examples/static/web2py_src.zip &&  \
 unzip -o web2py_src.zip && \
 rm -f web2py_src.zip

WORKDIR /home/web2py/web2py
RUN  cp handlers/wsgihandler.py .
CMD /usr/local/bin/gunicorn --workers 4 --timeout=90 --graceful-timeout=10 
--bind :9005 wsgihandler:application

2
#nginxDoc
FROM nginx:latest
COPY ./w2p.conf /etc/nginx/conf.d/
RUN apt update
RUN apt-get install curl -y
EXPOSE 80
CMD nginx -g "daemon off;"
3
#w2p.conf
upstream gunicorn {
server  172.25.0.22:9005 fail_timeout=0;
}

server {
listen172.25.0.23:80 default_server;

location / {
try_files $uri @proxy_to_gunicorn;
}

location @proxy_to_gunicorn {
 proxy_set_header X-Real-IP $remote_addr;
 proxy_redirect off;
 proxy_set_header Host $host;
proxy_pass http://gunicorn;
}
}

4
#run.sh
 docker rm $(docker stop $(docker ps -a -q --filter ancestor=w2pnginx 
--format="{{.ID}}"))
 docker rm $(docker stop $(docker ps -a -q --filter ancestor=w2pguni 
--format="{{.ID}}"))

docker network rm w2pnet
#docker network create w2pnet
docker network create --subnet=172.25.0.0/16 w2pnet

docker build -t w2pguni -f guniDoc .
docker run -d --net w2pnet -p 9005:9005 --hostname w2pname  --ip 
172.25.0.22   w2pguni

sleep 2
curl 172.25.0.22

docker build -t w2pnginx -f nginxDoc .
docker run -d --net w2pnet --ip 172.25.0.23  w2pnginx
sleep 2

curl 172.25.0.23

docker ps

. run.sh
view with firefox http://172.25.0.23


On Friday, January 5, 2018 at 5:45:04 AM UTC+3, 黄祥 wrote:
>
> just wondering why gunicorn dockerfile with web2py/anyserver.py is not 
> work when use with python:2.7 image
> e.g.
> *step i took*
> cat < Dockerfile
> FROM python:2.7
> RUN apt update && \
>  apt install -y unzip wget gunicorn
> RUN groupadd -r web2py && \
>  useradd -m -r -g web2py web2py
> USER web2py
> RUN cd /home/web2py/ && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/web2py/web2py/applications/examples && \
>  chmod 755 -R /home/web2py/web2py
> EXPOSE 80
> CMD cd ~ && python /home/web2py/web2py/anyserver.py -s gunicorn -i 0.0.0.0 
> -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> *result*
> starting gunicorn on 0.0.0.0:80...
> Traceback (most recent call last):
>   File "/home/web2py/web2py/anyserver.py", line 365, in 
> main()
>   File "/home/web2py/web2py/anyserver.py", line 362, in main
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 314, in run
> getattr(Servers, servername)(application, (ip, int(port)), 
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 137, in gunicorn
> from gunicorn.app.base import Application
> ImportError: No module named gunicorn.app.base
>
> but it works well when using ubuntu latest image
> *e.g.*
> *step i took*
> cat < Dockerfile
> FROM ubuntu:latest
> RUN apt update && \
>  apt install -y python python-pip python-setuptools unzip vim wget 
> gunicorn && \
>  pip install --upgrade pip && \
>  pip install virtualenv && \
>  virtualenv /home/site && \
>  rm -rf /home/site/web2py && \
>  cd /home/site/ && \
>  rm -f web2py_src.zip && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/site/web2py/applications/examples && \
>  chmod 755 -R /home/site/web2py
> EXPOSE 80 
> CMD . /home/site/bin/activate && /usr/bin/python 
> /home/site/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> all tested in https://labs.play-with-docker.com
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: web2py gunicorn dockerfile

2018-01-06 Thread Alex Beskopilny
small fix
1
FROM python:2.7
RUN apt update && apt install -y unzip wget
RUN /usr/local/bin/pip install gunicorn
RUN groupadd -r web2py &&  useradd -m -r -g web2py web2py
USER web2py
WORKDIR /home/web2py
RUN  wget -c http://web2py.com/examples/static/web2py_src.zip &&  unzip -o 
web2py_src.zip &&  rm -rf /home/web2py/web2py/applications/examples
EXPOSE 8000
WORKDIR /home/web2py/web2py
CMD /usr/local/bin/python anyserver.py -s gunicorn -i 0.0.0.0 -p 8000
2
 docker build -t w2p33 .
docker run -p3001:8000 -t w2p33
3
curl -I http://localhost:3001
HTTP/1.1 303 SEE OTHER
Server: gunicorn/19.7.1
Date: Sun, 07 Jan 2018 04:37:27 GMT
Connection: close
Content-Type: text/html; charset=UTF-8
Location: /welcome/default/index


On Friday, January 5, 2018 at 5:45:04 AM UTC+3, 黄祥 wrote:
>
> just wondering why gunicorn dockerfile with web2py/anyserver.py is not 
> work when use with python:2.7 image
> e.g.
> *step i took*
> cat < Dockerfile
> FROM python:2.7
> RUN apt update && \
>  apt install -y unzip wget gunicorn
> RUN groupadd -r web2py && \
>  useradd -m -r -g web2py web2py
> USER web2py
> RUN cd /home/web2py/ && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/web2py/web2py/applications/examples && \
>  chmod 755 -R /home/web2py/web2py
> EXPOSE 80
> CMD cd ~ && python /home/web2py/web2py/anyserver.py -s gunicorn -i 0.0.0.0 
> -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> *result*
> starting gunicorn on 0.0.0.0:80...
> Traceback (most recent call last):
>   File "/home/web2py/web2py/anyserver.py", line 365, in 
> main()
>   File "/home/web2py/web2py/anyserver.py", line 362, in main
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 314, in run
> getattr(Servers, servername)(application, (ip, int(port)), 
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 137, in gunicorn
> from gunicorn.app.base import Application
> ImportError: No module named gunicorn.app.base
>
> but it works well when using ubuntu latest image
> *e.g.*
> *step i took*
> cat < Dockerfile
> FROM ubuntu:latest
> RUN apt update && \
>  apt install -y python python-pip python-setuptools unzip vim wget 
> gunicorn && \
>  pip install --upgrade pip && \
>  pip install virtualenv && \
>  virtualenv /home/site && \
>  rm -rf /home/site/web2py && \
>  cd /home/site/ && \
>  rm -f web2py_src.zip && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/site/web2py/applications/examples && \
>  chmod 755 -R /home/site/web2py
> EXPOSE 80 
> CMD . /home/site/bin/activate && /usr/bin/python 
> /home/site/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> all tested in https://labs.play-with-docker.com
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: web2py gunicorn dockerfile

2018-01-06 Thread Alex Beskopilny

1 Dockerfile
FROM python:2.7
RUN apt update &&  apt install -y unzip wget
RUN /usr/local/bin/pip install gunicorn
RUN groupadd -r web2py &&  useradd -m -r -g web2py web2py
USER web2py
RUN cd /home/web2py/ &&  wget -c 
http://web2py.com/examples/static/web2py_src.zip &&  unzip -o 
web2py_src.zip &&  rm -rf /home/web2py/web2py/applications/examples &&  
chmod 755 -R /home/web2py/web2py
EXPOSE 8000
WORKDIR /home/web2py/web2py
CMD cd ~ && /usr/local/bin/python /home/web2py/web2py/anyserver.py -s 
gunicorn -i 0.0.0.0 -p 8000
2 
docker build -t w2p33 .
docker run -t w2p33
3 
curl -I http://localhost:3001
HTTP/1.1 303 SEE OTHER
Server: gunicorn/19.7.1
Date: Sun, 07 Jan 2018 04:13:58 GMT
Connection: close
Content-Type: text/html; charset=UTF-8
Location: /welcome/default/index

On Friday, January 5, 2018 at 5:45:04 AM UTC+3, 黄祥 wrote:
>
> just wondering why gunicorn dockerfile with web2py/anyserver.py is not 
> work when use with python:2.7 image
> e.g.
> *step i took*
> cat < Dockerfile
> FROM python:2.7
> RUN apt update && \
>  apt install -y unzip wget gunicorn
> RUN groupadd -r web2py && \
>  useradd -m -r -g web2py web2py
> USER web2py
> RUN cd /home/web2py/ && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/web2py/web2py/applications/examples && \
>  chmod 755 -R /home/web2py/web2py
> EXPOSE 80
> CMD cd ~ && python /home/web2py/web2py/anyserver.py -s gunicorn -i 0.0.0.0 
> -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> *result*
> starting gunicorn on 0.0.0.0:80...
> Traceback (most recent call last):
>   File "/home/web2py/web2py/anyserver.py", line 365, in 
> main()
>   File "/home/web2py/web2py/anyserver.py", line 362, in main
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 314, in run
> getattr(Servers, servername)(application, (ip, int(port)), 
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 137, in gunicorn
> from gunicorn.app.base import Application
> ImportError: No module named gunicorn.app.base
>
> but it works well when using ubuntu latest image
> *e.g.*
> *step i took*
> cat < Dockerfile
> FROM ubuntu:latest
> RUN apt update && \
>  apt install -y python python-pip python-setuptools unzip vim wget 
> gunicorn && \
>  pip install --upgrade pip && \
>  pip install virtualenv && \
>  virtualenv /home/site && \
>  rm -rf /home/site/web2py && \
>  cd /home/site/ && \
>  rm -f web2py_src.zip && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/site/web2py/applications/examples && \
>  chmod 755 -R /home/site/web2py
> EXPOSE 80 
> CMD . /home/site/bin/activate && /usr/bin/python 
> /home/site/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> all tested in https://labs.play-with-docker.com
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: web2py gunicorn dockerfile

2018-01-05 Thread Alex Beskopilny
Hi
set  WORKDIR in Dockerfile
..
WORKDIR /home/site/web2py
EXPOSE 80
CMD . /home/..
..
docker run 3001:80 image-name

On Friday, January 5, 2018 at 5:45:04 AM UTC+3, 黄祥 wrote:
>
> just wondering why gunicorn dockerfile with web2py/anyserver.py is not 
> work when use with python:2.7 image
> e.g.
> *step i took*
> cat < Dockerfile
> FROM python:2.7
> RUN apt update && \
>  apt install -y unzip wget gunicorn
> RUN groupadd -r web2py && \
>  useradd -m -r -g web2py web2py
> USER web2py
> RUN cd /home/web2py/ && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/web2py/web2py/applications/examples && \
>  chmod 755 -R /home/web2py/web2py
> EXPOSE 80
> CMD cd ~ && python /home/web2py/web2py/anyserver.py -s gunicorn -i 0.0.0.0 
> -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> *result*
> starting gunicorn on 0.0.0.0:80...
> Traceback (most recent call last):
>   File "/home/web2py/web2py/anyserver.py", line 365, in 
> main()
>   File "/home/web2py/web2py/anyserver.py", line 362, in main
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 314, in run
> getattr(Servers, servername)(application, (ip, int(port)), 
> options=options)
>   File "/home/web2py/web2py/anyserver.py", line 137, in gunicorn
> from gunicorn.app.base import Application
> ImportError: No module named gunicorn.app.base
>
> but it works well when using ubuntu latest image
> *e.g.*
> *step i took*
> cat < Dockerfile
> FROM ubuntu:latest
> RUN apt update && \
>  apt install -y python python-pip python-setuptools unzip vim wget 
> gunicorn && \
>  pip install --upgrade pip && \
>  pip install virtualenv && \
>  virtualenv /home/site && \
>  rm -rf /home/site/web2py && \
>  cd /home/site/ && \
>  rm -f web2py_src.zip && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/site/web2py/applications/examples && \
>  chmod 755 -R /home/site/web2py
> EXPOSE 80 
> CMD . /home/site/bin/activate && /usr/bin/python 
> /home/site/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 80
> EOF
> docker build .
> docker images
> docker run -p 80:80 imageid
>
> all tested in https://labs.play-with-docker.com
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: execute web2py modules in terminal on 2.16.1

2018-01-04 Thread Alex Beskopilny
Hi! 
replace print "install"
with print ("install")


On Tuesday, January 2, 2018 at 10:06:31 PM UTC+3, 黄祥 wrote:
>
> cant execute from terminal web2py modules while in previous version is 
> work fine
> *step on local machine (terminal)*
> python -V
> Python 2.7.10
> cd
> rm -rf ~/web2py/applications/test
> cp -R ~/web2py/applications/welcome/ ~/web2py/applications/test
> rsync -zavr ~/git/web2py/test ~/web2py/applications/
> rsync -zavur ~/git/web2py/test ~/web2py/applications/
> python ~/web2py/web2py.py --nogui --no-banner -S test -M -R 
> ~/web2py/applications/test/modules/test_install.py
>
> *modules/test_install.py*
> #!/usr/bin/env python
> # coding: utf8
> from gluon.contrib.webclient import WebClient
> *print "Install" # temporary solution is comment this line but it work 
> fine in web2py previous version*
> install = WebClient('http://127.0.0.1:8000/test/install/',
> postbacks = True)
> install.get('index')
>
> *error traceback on localhost*
> Traceback (most recent call last):
>   File "/Users/MacBookPro/project/python/web2py/gluon/shell.py", line 274, 
> in run
> execfile(startfile, _env)
>   File 
> "/Users/MacBookPro/project/python/web2py/applications/test/modules/test_install.py",
>  
> line 4
> print "Install"
>   ^
> SyntaxError: invalid syntax
>
> tested the same code in docker (https://labs.play-with-docker.com) same 
> result but different error traceback
> *error traceback on docker*
> Traceback (most recent call last):
>   File "/home/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "applications/init/models/db.py", line 36, in 
> check_reserved=['all'])
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/base.py", line 169, 
> in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/base.py", line 474, 
> in __init__
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/base.py", line 454, 
> in __init__
> self._adapter = adapter(**kwargs)
>   File 
> "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
> 40, in __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 368, in __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 52, in __init__
> self.reconnect()
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/connection.py", line 
> 152, in reconnect
> self.connection = self.connector()
>   File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", 
> line 42, in connector
> return self.driver.Connection(self.dbpath, **self.driver_args)
> OperationalError: unable to open database file
>
> The command '/bin/sh -c python /home/web2py/web2py/web2py.py --nogui 
> --no-banner -S init -M 
> -R/home/web2py/web2py/applications/init/modules/test_install.py' returned a 
> non-zero code: 1
>
> *step on docker (https://labs.play-with-docker.com 
> )*
> cat < Dockerfile
> FROM python:2.7
> RUN apt update && \
>  apt install -y unzip wget
> RUN groupadd -r web2py && \
>  useradd -m -r -g web2py web2py
> USER web2py
> RUN cd /home/web2py/ && \
>  wget -c http://web2py.com/examples/static/web2py_src.zip && \
>  unzip -o web2py_src.zip && \
>  rm -rf /home/web2py/web2py/applications/examples && \
>  cp -R /home/web2py/web2py/applications/welcome 
> /home/web2py/web2py/applications/init && \
>  chmod 755 -R /home/web2py/web2py
> COPY . /home/web2py/web2py/applications/init/
> RUN python /home/web2py/web2py/web2py.py --nogui --no-banner -S init -M -R 
> /home/web2py/web2py/applications/init/modules/test_install.py
> EXPOSE 8000
> CMD cd ~ && python /home/web2py/web2py/web2py.py --nogui --no-banner -a 
> 'a' -i 0.0.0.0 -p 8000
> EOF
> cat Dockerfile
> docker build .
> docker images
> docker run -p 8000:8000 image_id  
>
> any idea how to make it work in web2py latest version ?
> just an idea why not put Dockerfile or docker-compose.yml in 
> web2py/scripts/ as a template
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: Creating users and set the password, how??

2017-12-22 Thread Alex Beskopilny
#model/db.py

if not db().select(db.auth_user.ALL).first():
uid=db.auth_user.insert(
password = db.auth_user.password.validate('mypassword')[0],
email = 'n...@null.com',
first_name = 'Sy',
last_name = 'Adm',
)
gid=db.auth_group.insert ( role='000', description= 'AdmGrp')
db.auth_membership.insert(user_id= uid, group_id= gid )

On Wednesday, December 20, 2017 at 7:21:59 PM UTC+3, Ramos wrote:
>
> Hi, i´m creating users from a table.
> For each user i create a random password but i need to encrypt it right?
>
> How do i do that?
>
> i cannot just do this
>
> randompassword="ABC123"
>
> *db.auth_user.insert(*
> email=email,
> first_name='first_name',
> last_name='last_name',
> username=myvar,
> *password=myrandompassword*
> )
>
> 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.


[web2py] Re: fonts.googleapis

2017-12-13 Thread Alex Beskopilny


On Friday, December 8, 2017 at 1:06:35 PM UTC+3, T.R.Rajkumar wrote:
>
> I have an application. The views extend layout.html. When there is no 
> internet connection my pages wait for fonts.googleapis.com
> I dont want that to happen. How to remove the dependecy on 
> fonts.gooleapis.com
>

small fix. added google-svg-font 
5+  add to nginx
location ~* ^/(.*)\/static\/css\/(.*)\.(woff|eot|ttf|svg|woff2)$ {
alias /home/w2p/gofont/$2.$3;
#https://www.regexpal.com/93773
add_header Pragma public;
add_header Access-Control-Allow-Origin "*";
expires max;
#expires 30d;
}

-- 
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: fonts.googleapis

2017-12-08 Thread Alex Beskopilny


On Friday, December 8, 2017 at 1:06:35 PM UTC+3, T.R.Rajkumar wrote:
>
> I have an application. The views extend layout.html. When there is no 
> internet connection my pages wait for fonts.googleapis.com
> I dont want that to happen. How to remove the dependecy on 
> fonts.gooleapis.com
>
hI! 
1  get downloader  (google-font-download  - bash script)
git clone https://github.com/neverpanic/google-font-download
2 view fonts in 
/home/w2p/web2py/applications/myapp/static/css/bootstrap.min.css
@import 
url("https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700";)
3 mkdir /home/w2p/mygoogfont
   cd /home/w2p/mygoogfont
   get fonts (with your locale ! mylocale - cyrillic)
./google-font-download  "Open Sans:300" "Open Sans:400" "Open Sans:700" 
"Open Sans:300italic" "Open Sans:400italic"  "Open Sans:700italic" 
-lcyrillic,latin
4  cp font.css   /home/w2p/web2py/applications/myapp/static/css
and change import string in bootstrap.min.css   @import url("font.css");
5  add to nginx 
location ~* ^/(.*)\/static\/css\/(.*)\.(woff|eot|ttf|woff2)$ {
alias /home/w2p/mygoogfont/$2.$3;
#https://www.regexpal.com/93773
add_header Pragma public;
add_header Access-Control-Allow-Origin "*";
expires 30d;
}

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