Exemple #1
0
 def backend_module(self):
     if self.outbound_module == 'corehq.apps.kookoo.api':
         self.outbound_module = 'corehq.messaging.ivrbackends.kookoo.api'
     module = try_import(self.outbound_module)
     if not module:
         raise RuntimeError('could not find outbound module %s' % self.outbound_module)
     return module
Exemple #2
0
 def backend_module(self):
     module = try_import(self.outbound_module)
     if not module:
         raise RuntimeError('could not find outbound module %s' % self.outbound_module)
     return module
Exemple #3
0
    (r'', include('corehq.apps.xforms.urls')),
    (r'', include('corehq.apps.program.urls')),
    (r'user_registration', include("django_user_registration.urls")),    
)

# magic static media server (idea + implementation lifted from rapidsms)
for module_name in settings.INSTALLED_APPS:

    # leave django contrib apps alone. (many of them include urlpatterns
    # which shouldn't be auto-mapped.) this is a hack, but i like the
    # automatic per-app mapping enough to keep it. (for now.)
    if module_name.startswith("django."):
        continue

    # attempt to import this app's urls
    module = try_import("%s.urls" % (module_name))
    if not hasattr(module, "urlpatterns"): continue

    
    # if the MEDIA_URL does not contain a hostname (ie, it's just an
    # http path), and we are running in DEBUG mode, we will also serve
    # the media for this app via this development server. in production,
    # these files should be served directly
    if settings.DEBUG:
        if not settings.MEDIA_URL.startswith("http://"):
            media_prefix = settings.MEDIA_URL.strip("/")
            module_suffix = module_name.split(".")[-1]

            # does urls.py have a sibling "static" dir? (media is always
            # served from "static", regardless of what MEDIA_URL says)
            module_path = os.path.dirname(module.__file__)
Exemple #4
0
 def backend_module(self):
     module = try_import(self.outbound_module)
     if not module:
         raise RuntimeError('could not find outbound module %s' %
                            self.outbound_module)
     return module