Exemple #1
0
         import thread
         self['lock']=thread.allocate_lock()
    def __setattr__(self,key,value):
         self['lock'].acquire()
         self[key]=value
         self['lock'].release()
    def __getattr__(self,key):
         self['lock'].acquire()
         value=self[key]
         self['lock'].release()
         return value

#x=cache.ram('elefante_in_sala_server',lambda:ThreadSafe(),ThreadSafe.forever)


################################################################
# Import the database and global settings from the config file #
################################################################
settings = Storage()
settings.globals = ConfigFile(cfgfile, 'global')
settings.database = ConfigFile(cfgfile, 'database')

response.headers.pop('X-Powered-By')
response.headers['Server'] = settings.globals.servername

T.set_current_languages('en', 'en-en')
plugin_translate_current_language = 'en'
session._language = request.vars._language or session._language or plugin_translate_current_language
T.force(str(session._language))

Exemple #2
0
from gluon.storage import Storage
from gluon import current
from prettyexception import ErrorHTTP
settings = Storage()


#Check if user on the startup. Set to False if you have user on the system
settings.check_if_user=True

#mysql or sqlite
settings.database='sqlite'

##To connect to a Mysql Databse
settings.database_name='MY_DATABASE_NAME' #First: create database MY_DATABASE_NAME CHARACTER SET utf8 COLLATE utf8_general_ci;
settings.database_user='******'
settings.database_pass='******'
settings.database_uri='MY_DATABASE_URI'
settings.migrate = True #If you have the dababase and tables aready created, please set this value to: False
settings.title = 'Monitor'
settings.subtitle = 'powered by web2py'
settings.author = 'Jose de Soto'
settings.author_email = '*****@*****.**'
settings.keywords = 'monitor, statistics, server'
settings.description = 'Web application that allows to view rrd datacollections that have been created by collectd.'
settings.security_key = 'd110e72d-83fb-40bc-bb1c-a62e324c80bc'
settings.login_method = 'local' #local, ldap or CAS
settings.login_config = ''
settings.plugins = []

#########################################
#if LDAP configuration:			#