Re: [web2py] Web2py and database integration

2021-05-17 Thread Massimiliano
Hi F.C,

the scheduler is initialized with db instead db_hivetu.

scheduler = Scheduler(db,
heartbeat=configuration.get('scheduler.heartbeat'))

 the best practice is,

change your connection string in : private/appconfig.ini

; db configuration
[db]
uri   = postgres://hiveuser:password@127.0.0.1:5433/hivetu

and keep db.py for configuration only.
Auth behaviour, mail , scheduler etc.


Il giorno dom 16 mag 2021 alle ore 15:11 F.C.  ha
scritto:

> # -*- coding: utf-8 -*-
>
> # -
> # AppConfig configuration made easy. Look inside private/appconfig.ini
> # Auth is for authentication and access control
> # -
> from gluon.contrib.appconfig import AppConfig
> from gluon.tools import Auth
>
> # -
> # This scaffolding model makes your app work on Google App Engine too
> # File is released under public domain and you can use without limitations
> # -
>
> if request.global_settings.web2py_version < "2.15.5":
> raise HTTP(500, "Requires web2py 2.15.5 or newer")
>
> # -
> # if SSL/HTTPS is properly configured and you want all HTTP requests to
> # be redirected to HTTPS, uncomment the line below:
> # -
> # request.requires_https()
>
> # -
> # once in production, remove reload=True to gain full speed
> # -
> configuration = AppConfig(reload=True)
>
> db_hivetu = DAL('postgres://hiveuser:password@127.0.0.1:5433/hivetu',
> pool_size=configuration.get('db.pool_size'),
> check_reserved=['all'])
>
>
> # -
> # by default give a view/generic.extension to all actions from localhost
> # none otherwise. a pattern can be 'controller/function.extension'
> # -
> response.generic_patterns = []
> if request.is_local and not configuration.get('app.production'):
> response.generic_patterns.append('*')
>
> # -
> # choose a style for forms
> # -
> response.formstyle = 'bootstrap4_inline'
> response.form_label_separator = ''
>
> # -
> # (optional) optimize handling of static files
> # -
> # response.optimize_css = 'concat,minify,inline'
> # response.optimize_js = 'concat,minify,inline'
>
> # -
> # (optional) static assets folder versioning
> # -
> # response.static_version = '0.0.0'
>
> # -
> # Here is sample code if you need for
> # - email capabilities
> # - authentication (registration, login, logout, ... )
> # - authorization (role based authorization)
> # - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
> # - old style crud actions
> # (more options discussed in gluon/tools.py)
> # -
>
> # ---
> # - Authentication pages
> # ---
> auth = Auth(db_hivetu)
> auth.settings.controller = 'default'
> auth.define_tables(username=False, signature=False)
>
> # Page - subsequent to logging out
> auth.settings.logout_next = URL(a='hivetu', c='default', f='index')
>
>
> # Redirect the user if they try to access the registration page after they
> have already logged in
> auth.settings.logged_url =
> URL(a='hivetu',c='default',f='user',args='dashboard')
>
> # Redirect to another page on a failed login
> auth.settings.on_failed_authorization =
> URL(a='hivetu',c='default',f='user', args='on_failed_authorization')
>
> # Log someone in after they have registered
> auth.settings.login_after_registration = False
>
>
> # -
> # create all tables needed by auth, maybe add a list of extra fields
> # -
> auth.settings.extra_fields['auth_user'] = []
>
>
> # -
> # configure email
> # 

Re: [web2py] Web2py and database integration

2021-05-16 Thread Maurice Waka
Your connection string... db_hivetu


But your table is declared with db.define_tablenot
db_hivetu.define_yable

On Sun, May 16, 2021, 4:11 PM F.C.  wrote:

> # -*- coding: utf-8 -*-
>
> # -
> # AppConfig configuration made easy. Look inside private/appconfig.ini
> # Auth is for authentication and access control
> # -
> from gluon.contrib.appconfig import AppConfig
> from gluon.tools import Auth
>
> # -
> # This scaffolding model makes your app work on Google App Engine too
> # File is released under public domain and you can use without limitations
> # -
>
> if request.global_settings.web2py_version < "2.15.5":
> raise HTTP(500, "Requires web2py 2.15.5 or newer")
>
> # -
> # if SSL/HTTPS is properly configured and you want all HTTP requests to
> # be redirected to HTTPS, uncomment the line below:
> # -
> # request.requires_https()
>
> # -
> # once in production, remove reload=True to gain full speed
> # -
> configuration = AppConfig(reload=True)
>
> db_hivetu = DAL('postgres://hiveuser:password@127.0.0.1:5433/hivetu',
> pool_size=configuration.get('db.pool_size'),
> check_reserved=['all'])
>
>
> # -
> # by default give a view/generic.extension to all actions from localhost
> # none otherwise. a pattern can be 'controller/function.extension'
> # -
> response.generic_patterns = []
> if request.is_local and not configuration.get('app.production'):
> response.generic_patterns.append('*')
>
> # -
> # choose a style for forms
> # -
> response.formstyle = 'bootstrap4_inline'
> response.form_label_separator = ''
>
> # -
> # (optional) optimize handling of static files
> # -
> # response.optimize_css = 'concat,minify,inline'
> # response.optimize_js = 'concat,minify,inline'
>
> # -
> # (optional) static assets folder versioning
> # -
> # response.static_version = '0.0.0'
>
> # -
> # Here is sample code if you need for
> # - email capabilities
> # - authentication (registration, login, logout, ... )
> # - authorization (role based authorization)
> # - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
> # - old style crud actions
> # (more options discussed in gluon/tools.py)
> # -
>
> # ---
> # - Authentication pages
> # ---
> auth = Auth(db_hivetu)
> auth.settings.controller = 'default'
> auth.define_tables(username=False, signature=False)
>
> # Page - subsequent to logging out
> auth.settings.logout_next = URL(a='hivetu', c='default', f='index')
>
>
> # Redirect the user if they try to access the registration page after they
> have already logged in
> auth.settings.logged_url =
> URL(a='hivetu',c='default',f='user',args='dashboard')
>
> # Redirect to another page on a failed login
> auth.settings.on_failed_authorization =
> URL(a='hivetu',c='default',f='user', args='on_failed_authorization')
>
> # Log someone in after they have registered
> auth.settings.login_after_registration = False
>
>
> # -
> # create all tables needed by auth, maybe add a list of extra fields
> # -
> auth.settings.extra_fields['auth_user'] = []
>
>
> # -
> # configure email
> # -
> mail = auth.settings.mailer
> mail.settings.server = 'logging' if request.is_local else
> configuration.get('smtp.server')
> mail.settings.sender = configuration.get('smtp.sender')
> mail.settings.login = configuration.get('smtp.login')
> mail.settings.tls = 

Re: [web2py] Web2py and database integration

2021-05-16 Thread F.C.
# -*- coding: utf-8 -*-

# -
# AppConfig configuration made easy. Look inside private/appconfig.ini
# Auth is for authentication and access control
# -
from gluon.contrib.appconfig import AppConfig
from gluon.tools import Auth

# -
# This scaffolding model makes your app work on Google App Engine too
# File is released under public domain and you can use without limitations
# -

if request.global_settings.web2py_version < "2.15.5":
raise HTTP(500, "Requires web2py 2.15.5 or newer")

# -
# if SSL/HTTPS is properly configured and you want all HTTP requests to
# be redirected to HTTPS, uncomment the line below:
# -
# request.requires_https()

# -
# once in production, remove reload=True to gain full speed
# -
configuration = AppConfig(reload=True)

db_hivetu = DAL('postgres://hiveuser:password@127.0.0.1:5433/hivetu',
pool_size=configuration.get('db.pool_size'),
check_reserved=['all'])


# -
# by default give a view/generic.extension to all actions from localhost
# none otherwise. a pattern can be 'controller/function.extension'
# -
response.generic_patterns = [] 
if request.is_local and not configuration.get('app.production'):
response.generic_patterns.append('*')

# -
# choose a style for forms
# -
response.formstyle = 'bootstrap4_inline'
response.form_label_separator = ''

# -
# (optional) optimize handling of static files
# -
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'

# -
# (optional) static assets folder versioning
# -
# response.static_version = '0.0.0'

# -
# Here is sample code if you need for
# - email capabilities
# - authentication (registration, login, logout, ... )
# - authorization (role based authorization)
# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
# - old style crud actions
# (more options discussed in gluon/tools.py)
# -

# ---
# - Authentication pages
# ---
auth = Auth(db_hivetu)
auth.settings.controller = 'default'
auth.define_tables(username=False, signature=False)

# Page - subsequent to logging out
auth.settings.logout_next = URL(a='hivetu', c='default', f='index')


# Redirect the user if they try to access the registration page after they 
have already logged in
auth.settings.logged_url = 
URL(a='hivetu',c='default',f='user',args='dashboard')

# Redirect to another page on a failed login
auth.settings.on_failed_authorization = 
URL(a='hivetu',c='default',f='user', args='on_failed_authorization')

# Log someone in after they have registered
auth.settings.login_after_registration = False


# -
# create all tables needed by auth, maybe add a list of extra fields
# -
auth.settings.extra_fields['auth_user'] = []


# -
# configure email
# -
mail = auth.settings.mailer
mail.settings.server = 'logging' if request.is_local else 
configuration.get('smtp.server')
mail.settings.sender = configuration.get('smtp.sender')
mail.settings.login = configuration.get('smtp.login')
mail.settings.tls = configuration.get('smtp.tls') or False
mail.settings.ssl = configuration.get('smtp.ssl') or False

# -
# configure auth policy
# -
auth.settings.registration_requires_verification = False

Re: [web2py] Web2py and database integration

2021-05-14 Thread Christian Varas
Could you share your db.py ? Maybe there are declared 2 connections to db
 and one might be overwriting the one who connects to postgresql.


Cheers.
Chris.

El El vie, 14 de may. de 2021 a la(s) 15:22, F.C. 
escribió:

> I  need some help. I have started web2py development with a passion to
> really master it. I love python and really want to see if I can find some
> excellent uses for writing online applications.
>
> The weird problem I am running into is the following and I need some help.
>
> I have an application where I have setup a connection string to an online
> postgresql database. When I run a select query it shows that it is a sqlite
> database connection to a local database on disk but that is not how I set
> it up.
>
> The effect is that my login and registration screens do not work and I am
> not sure what I am doing wrong.
>
> What is the best way to debug this issue?
>
>
> --
> 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/1becabf7-c5ab-4e68-acd1-f803c18a6548n%40googlegroups.com
> 
> .
>

-- 
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/CA%2Bs%2BuJuRN0t92ckr6i53C-nMeF243nt4avyF0zx1cYCh_wRjUw%40mail.gmail.com.


[web2py] Web2py and database integration

2021-05-14 Thread F.C.
I  need some help. I have started web2py development with a passion to 
really master it. I love python and really want to see if I can find some 
excellent uses for writing online applications. 

The weird problem I am running into is the following and I need some help.

I have an application where I have setup a connection string to an online 
postgresql database. When I run a select query it shows that it is a sqlite 
database connection to a local database on disk but that is not how I set 
it up. 

The effect is that my login and registration screens do not work and I am 
not sure what I am doing wrong.

What is the best way to debug this issue?


-- 
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/1becabf7-c5ab-4e68-acd1-f803c18a6548n%40googlegroups.com.