def thywill(request): ''' Deliver the basic thywill framing page, immediately prior to bootstrap. :Parameters: - request: HttpRequest :Return: HttpResponse ''' uuid = __ensure_uuid(request) config = ClientInterfaceComponent.factory().create_client_configuration(uuid) context = Context({ 'config': config.to_dict(), 'config_json': config.to_json(True), }) LogComponent.debug(['django.requests.thywill', 'initial client page load', uuid, config.to_dict()]) return HttpResponse(get_template('thywill.html').render(context))
#!/usr/bin/env python ''' This module is called as a script after installation of thywill in order to run necessary setup tasks. ''' import sys import thywill_server.settings as settings paths = [] paths.append(settings.THYWILL_ROOT + '/thywill_server/src/') paths.append(settings.THYWILL_ROOT + '/thywill_apps/src/') for path in paths: if path not in sys.path: sys.path.append(path) #-------------------------------------------------------------------- # Django setup #-------------------------------------------------------------------- from thywill_server.client_interface.client_interface_component import ClientInterfaceComponent from thywill_server.client_interface.django.component import DjangoComponent client_interface_component = ClientInterfaceComponent.factory() if isinstance(client_interface_component, DjangoComponent): from django.core import management import os os.environ[ 'DJANGO_SETTINGS_MODULE'] = 'thywill_server.client_interface.django.settings' management.call_command('syncdb')
''' thywill django settings. Pulls in some information from the general thywill configuration. ''' #------------------------------------------------------ # START additions to standard django settings layout #------------------------------------------------------ from thywill_server.client_interface.client_interface_component import ClientInterfaceComponent from thywill_server.database.database_component import DatabaseComponent from thywill_server.database.mysql.component import MysqlComponent django_component = ClientInterfaceComponent.factory() database_component = DatabaseComponent.factory() def get_database_engine(): if( isinstance(database_component, MysqlComponent) ): return 'django.db.backends.mysql'; else: raise NotImplementedError('Unsupported database engine in Django component settings.'); #------------------------------------------------------ # END additions to standard django settings layout #------------------------------------------------------ DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = (
#!/usr/bin/env python ''' This module is called as a script after installation of thywill in order to run necessary setup tasks. ''' import sys import thywill_server.settings as settings paths = [] paths.append(settings.THYWILL_ROOT +'/thywill_server/src/') paths.append(settings.THYWILL_ROOT +'/thywill_apps/src/') for path in paths: if path not in sys.path: sys.path.append(path) #-------------------------------------------------------------------- # Django setup #-------------------------------------------------------------------- from thywill_server.client_interface.client_interface_component import ClientInterfaceComponent from thywill_server.client_interface.django.component import DjangoComponent client_interface_component = ClientInterfaceComponent.factory() if isinstance(client_interface_component, DjangoComponent): from django.core import management import os os.environ['DJANGO_SETTINGS_MODULE'] = 'thywill_server.client_interface.django.settings' management.call_command('syncdb')