# -*- 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 auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True # ------------------------------------------------------------------------- # read more at http://dev.w3.org/html5/markup/meta.name.html # ------------------------------------------------------------------------- response.meta.author = configuration.get('app.author') response.meta.description = configuration.get('app.description') response.meta.keywords = configuration.get('app.keywords') response.meta.generator = configuration.get('app.generator') response.show_toolbar = configuration.get('app.toolbar') # ------------------------------------------------------------------------- # your http://google.com/analytics id # ------------------------------------------------------------------------- response.google_analytics_id = configuration.get('google.analytics_id') # ------------------------------------------------------------------------- # maybe use the scheduler # ------------------------------------------------------------------------- if configuration.get('scheduler.enabled'): from gluon.scheduler import Scheduler scheduler = Scheduler(db, heartbeat=configuration.get('scheduler.heartbeat')) # ------------------------------------------------------------------------- # Define your tables below (or better in another model file) for example # # >>> db.define_table('mytable', Field('myfield', 'string')) # # Fields can be 'string','text','password','integer','double','boolean' # 'date','time','datetime','blob','upload', 'reference TABLENAME' # There is an implicit 'id integer autoincrement' field # Consult manual for more options, validators, etc. # # More API examples for controllers: # # >>> db.mytable.insert(myfield='value') # >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL) # >>> for row in rows: print row.id, row.myfield # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # after defining tables, uncomment below to enable auditing # ------------------------------------------------------------------------- # auth.enable_record_versioning(db) On Friday, May 14, 2021 at 7:35:46 PM UTC-5 chriii...@gmail.com wrote: > 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. <fcba...@gmail.com> > 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+un...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/1becabf7-c5ab-4e68-acd1-f803c18a6548n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/1becabf7-c5ab-4e68-acd1-f803c18a6548n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/7c1cb3ab-8fa0-4695-9a51-e21865086103n%40googlegroups.com.