Reload application configuration

4 views
Skip to first unread message

Guilhelm

unread,
Nov 15, 2009, 3:33:27 PM11/15/09
to cherrypy-users
Hello,

I have a web application using Cherrypy 3.1 that I start with the
"startServer" method

def getusers():

'''Returns a dictionnary :
- key : user login
- value : user password hash
'''
all_users = {}
for utilisateur in wapp.creche.utilisateurs:
all_users[utilisateur.login] = utilisateur.motDePasseChiffre

return all_users


def app_conf():
conf={'/': {'tools.basic_auth.on': True,
'tools.basic_auth.realm' : 'localhost',
'tools.basic_auth.users' : getusers(),
'tools.staticdir.root': current_dir,
'tools.sessions.on': True,
'tools.sessions.timeout': 60
}
}
return conf

def startServer(port_app):

cherrypy.config.update({'environment': 'production',
'log.error_file': '/tmp/site.log',
'log.screen': True})


conf_global = {'environment': 'production' ,
'log.error_file': '/tmp/site.log' ,
'log.screen': True ,
'server.socket_port': port_app ,
'server.ssl_certificate' : os.path.join
(current_dir,'ssl','monsite.cert.cert') ,
'server.ssl_private_key' : os.path.join
(current_dir,'ssl','monsite.cert.key') ,
'tools.encode.encoding': 'utf-8' ,
'tools.decode.on': True
}

cherrypy.config.update(conf_global)

app=cherrypy.tree.mount(accueil(),'/', config=app_conf())


return app

In that web-application users can update their password and the
administrator can create new users. How can I "reload" the application
configuration to take into account new users or modified passwords ?

Thanks for any help !
Reply all
Reply to author
Forward
0 new messages