# Cache Memcached Servers # (Only if SESSION_STORE_CLASS or CACHE_TYPE is Memcached) # eg: ['localhost:11211'] #CACHE_MEMCACHED_SERVERS = ['localhost:11211'], #CACHE_MEMCACHED_SERVERS = ['mc1:11211', 'mc2:11211'], # If the application is to be configured in the debug mode DEBUG = False, TEMPLATE_LOADER_CLASS = 'nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH = '%s' % cwd, TRANSLATIONS_PATH = '%s/i18n/' % cwd, ) app = Nereid() app.config.update(CONFIG) app.initialise() app.jinja_env.globals.update({'json': json, 'sample': random.sample}) babelized_app = Babel(app) application = babelized_app.app.wsgi_app application = Sentry( application, Client('http://*****:*****@sentry.openlabs.co.in/10') ) # If the file is launched from the CLI then launch the app using the debug # web server built into werkzeug if __name__ == '__main__':
TRYTON_CONFIG='../../etc/trytond.conf', # If the application is to be configured in the debug mode DEBUG=False, # Load the template from FileSystem in the path below instead of the # default Tryton loader where templates are loaded from Database TEMPLATE_LOADER_CLASS='nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH='.', # The location where the translations of this template are stored TRANSLATIONS_PATH='i18n', ) # Create a new application app = Nereid(static_folder='%s/static/' % CWD, static_url_path='/static') # Update the configuration with the above config values app.config.update(CONFIG) # Initialise the app, connect to cache and backend app.initialise() # Setup the filesystem cache app.session_interface.session_store = FilesystemSessionStore( '/tmp', session_class=Session) Babel(app) if __name__ == '__main__': app.debug = True
# Tryton Config file path TRYTON_CONFIG = 'test.conf', SECRET_KEY = 'admin', # If the application is to be configured in the debug mode DEBUG = False, # Load the template from FileSystem in the path below instead of the # default Tryton loader where templates are loaded from Database TEMPLATE_LOADER_CLASS = 'nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH = 'test/', ) # Create a new application app = Nereid() # Update the configuration with the above config values app.config.update(CONFIG) # Initialise the app, connect to cache and backend app.initialise() class NereidHostChangeMiddleware(object): """ A middleware which alters the HTTP_HOST so that you can test the site locally. This middleware replaces the HTTP_HOST with the value you prove to the :attr: site :param app: The application for which the middleware needs to work
# Cache Memcached Servers # (Only if SESSION_STORE_CLASS or CACHE_TYPE is Memcached) # eg: ['localhost:11211'] #CACHE_MEMCACHED_SERVERS = ['localhost:11211'], #CACHE_MEMCACHED_SERVERS = ['localhost:11211'], # If the application is to be configured in the debug mode DEBUG=False, TEMPLATE_LOADER_CLASS='nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH='%s/templates/' % cwd, TRANSLATIONS_PATH='%s/i18n/' % cwd, ) # Create a new application app = Nereid() app.session_interface.session_store = FilesystemSessionStore( '/tmp', session_class=Session) # Update the configuration with the above config values app.config.update(CONFIG) # Initialise the app, connect to cache and backend app.initialise() babelized_app = Babel(app) application = babelized_app.app.wsgi_app class NereidHostChangeMiddleware(object): """
# Static file root. The root location of the static files. The static/ will # point to this location. It is recommended to use the web server to serve # static content STATIC_FILEROOT='static/', # Tryton Config file path TRYTON_CONFIG='trytond/etc/trytond.conf', # If the application is to be configured in the debug mode DEBUG=True, # Load the template from FileSystem in the path below instead of the # default Tryton loader where templates are loaded from Database TEMPLATE_LOADER_CLASS='nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH='.', ) # Create a new application app = Nereid() # Update the configuration with the above config values app.config.update(CONFIG) # Initialise the app, connect to cache and backend app.initialise() if __name__ == '__main__': app.debug = True app.run('0.0.0.0')
DEBUG=False, # The location where the translations of this template are stored TRANSLATIONS_PATH='i18n', # Secret Key: Replace this with something random # A good way to generate such a number would be # # >>> import os # >>> os.urandom(20) # SECRET_KEY='\xcd\x04}\x8d\\j-\x98b\xf2' ) # Create a new application app = Nereid(static_folder='%s/static/' % CWD, static_url_path='/static') # Update the configuration with the above config values app.config.update(CONFIG) # Initialise the app, connect to cache and backend app.initialise() # Setup the filesystem cache app.session_interface.session_store = FilesystemSessionStore( '/tmp', session_class=Session ) Babel(app)
#CACHE_TYPE = 'werkzeug.contrib.cache.MemcachedCache', # Cache Memcached Servers # (Only if SESSION_STORE_CLASS or CACHE_TYPE is Memcached) # eg: ['localhost:11211'] #CACHE_MEMCACHED_SERVERS = ['localhost:11211'], #CACHE_MEMCACHED_SERVERS = ['mc1:11211', 'mc2:11211'], # If the application is to be configured in the debug mode DEBUG=False, TEMPLATE_LOADER_CLASS='nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH='%s' % cwd, TRANSLATIONS_PATH='%s/i18n/' % cwd, ) app = Nereid() app.config.update(CONFIG) app.initialise() app.jinja_env.globals.update({ 'json': json, 'sample': random.sample, 'datetime': datetime, }) def float_to_time(hours): "Converts a float of hours into readable hours and mins" return "%dh %dm" % (hours, (hours * 60) % 60) app.jinja_env.filters['float_to_time'] = float_to_time
# Cache Memcached Servers # (Only if SESSION_STORE_CLASS or CACHE_TYPE is Memcached) # eg: ['localhost:11211'] #CACHE_MEMCACHED_SERVERS = ['localhost:11211'], #CACHE_MEMCACHED_SERVERS = ['localhost:11211'], # If the application is to be configured in the debug mode DEBUG = False, TEMPLATE_LOADER_CLASS = 'nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH = '%s/templates/' % cwd, TRANSLATIONS_PATH = '%s/i18n/' % cwd, ) # Create a new application app = Nereid() app.session_interface.session_store = FilesystemSessionStore( '/tmp', session_class=Session ) # Update the configuration with the above config values app.config.update(CONFIG) # Initialise the app, connect to cache and backend app.initialise() babelized_app = Babel(app) application = babelized_app.app.wsgi_app
TRYTON_CONFIG="%s/etc/trytond.conf" % app_root_path, # Cache backend type # CACHE_TYPE = 'werkzeug.contrib.cache.MemcachedCache', # Cache Memcached Servers # (Only if SESSION_STORE_CLASS or CACHE_TYPE is Memcached) # eg: ['localhost:11211'] # CACHE_MEMCACHED_SERVERS = ['localhost:11211'], # CACHE_MEMCACHED_SERVERS = ['mc1:11211', 'mc2:11211'], # If the application is to be configured in the debug mode DEBUG=False, TEMPLATE_LOADER_CLASS="nereid.templating.FileSystemLoader", TEMPLATE_SEARCH_PATH="%s" % cwd, TRANSLATIONS_PATH="%s/i18n/" % cwd, ) app = Nereid() app.config.update(CONFIG) app.initialise() app.jinja_env.globals.update({"json": json, "sample": random.sample}) babelized_app = Babel(app) application = babelized_app.app.wsgi_app # application = Sentry( # application, Client('http://sjkdhsadjkwi423y8wkjhwuiy@localhost:9000/7') # ) # If the file is launched from the CLI then launch the app using the debug # web server built into werkzeug if __name__ == "__main__":
# Cache Memcached Servers # (Only if SESSION_STORE_CLASS or CACHE_TYPE is Memcached) # eg: ['localhost:11211'] # CACHE_MEMCACHED_SERVERS = ['localhost:11211'], # CACHE_MEMCACHED_SERVERS = ['mc1:11211', 'mc2:11211'], # If the application is to be configured in the debug mode DEBUG=False, TEMPLATE_LOADER_CLASS='nereid.templating.FileSystemLoader', TEMPLATE_SEARCH_PATH='%s' % cwd, TRANSLATIONS_PATH='%s/i18n/' % cwd, ) app = Nereid() app.config.update(CONFIG) app.initialise() app.jinja_env.globals.update({'json': json, 'sample': random.sample}) babelized_app = Babel(app) application = babelized_app.app.wsgi_app # If the file is launched from the CLI then launch the app using the debug # web server built into gevent WSGIServer if __name__ == '__main__': class NereidTestMiddleware(object): def __init__(self, app, site): self.app = app self.site = site
from nereid import Nereid from trytond.config import CONFIG CONFIG.update_etc('/home/umangarora/trytond.conf') app = Nereid() app.config.update({ 'DATABASE_NAME': 'tul2014', 'SECRET_KEY': 'somekey', }) app.initialise() if __name__ == '__main__': app.debug = True app.run()