dddp/views.py
def get(self, request, path):
        """Return HTML (or other related content) for Meteor."""
        if path == 'meteor_runtime_config.js':
            config = {
                'DDP_DEFAULT_CONNECTION_URL': request.build_absolute_uri('/'),
                'PUBLIC_SETTINGS': self.meteor_settings.get('public', {}),
                'ROOT_URL': request.build_absolute_uri(
                    '%s/' % (
                        self.runtime_config.get('ROOT_URL_PATH_PREFIX', ''),
                    ),
                ),
                'ROOT_URL_PATH_PREFIX': '',
            }
            # Use HTTPS instead of HTTP if SECURE_SSL_REDIRECT is set
            if config['DDP_DEFAULT_CONNECTION_URL'].startswith('http:') \
                    and settings.SECURE_SSL_REDIRECT:
                config['DDP_DEFAULT_CONNECTION_URL'] = 'https:%s' % (
                    config['DDP_DEFAULT_CONNECTION_URL'].split(':', 1)[1],
                )
            config.update(self.runtime_config)
            return HttpResponse(
                '__meteor_runtime_config__ = %s;' % dumps(config),
                content_type='text/javascript',
            )
        try:
            file_path, content_type = self.url_map[path]
            with open(file_path, 'r') as content:
                return HttpResponse(
                    content.read(),
                    content_type=content_type,
                )
        except KeyError:
            return HttpResponse(self.html)
def get(self, request, path):
        """Return HTML (or other related content) for Meteor."""
        if path == 'meteor_runtime_config.js':
            config = {
                'DDP_DEFAULT_CONNECTION_URL': request.build_absolute_uri('/'),
                'PUBLIC_SETTINGS': self.meteor_settings.get('public', {}),
                'ROOT_URL': request.build_absolute_uri(
                    '%s/' % (
                        self.runtime_config.get('ROOT_URL_PATH_PREFIX', ''),
                    ),
                ),
                'ROOT_URL_PATH_PREFIX': '',
            }
            # Use HTTPS instead of HTTP if SECURE_SSL_REDIRECT is set
            if config['DDP_DEFAULT_CONNECTION_URL'].startswith('http:') \
                    and settings.SECURE_SSL_REDIRECT:
                config['DDP_DEFAULT_CONNECTION_URL'] = 'https:%s' % (
                    config['DDP_DEFAULT_CONNECTION_URL'].split(':', 1)[1],
                )
            config.update(self.runtime_config)
            return HttpResponse(
                '__meteor_runtime_config__ = %s;' % dumps(config),
                content_type='text/javascript',
            )
        try:
            file_path, content_type = self.url_map[path]
            with open(file_path, 'r') as content:
                return HttpResponse(
                    content.read(),
                    content_type=content_type,
                )
        except KeyError:
            return HttpResponse(self.html)
def get ( self , request , path ) : if path == 'meteor_runtime_config.js' : config = { 'DDP_DEFAULT_CONNECTION_URL' : request . build_absolute_uri ( '/' ) , 'PUBLIC_SETTINGS' : self . meteor_settings . get ( 'public' , { } ) , 'ROOT_URL' : request . build_absolute_uri ( '%s/' % ( self . runtime_config . get ( 'ROOT_URL_PATH_PREFIX' , '' ) , ) , ) , 'ROOT_URL_PATH_PREFIX' : '' , } # Use HTTPS instead of HTTP if SECURE_SSL_REDIRECT is set if config [ 'DDP_DEFAULT_CONNECTION_URL' ] . startswith ( 'http:' ) and settings . SECURE_SSL_REDIRECT : config [ 'DDP_DEFAULT_CONNECTION_URL' ] = 'https:%s' % ( config [ 'DDP_DEFAULT_CONNECTION_URL' ] . split ( ':' , 1 ) [ 1 ] , ) config . update ( self . runtime_config ) return HttpResponse ( '__meteor_runtime_config__ = %s;' % dumps ( config ) , content_type = 'text/javascript' , ) try : file_path , content_type = self . url_map [ path ] with open ( file_path , 'r' ) as content : return HttpResponse ( content . read ( ) , content_type = content_type , ) except KeyError : return HttpResponse ( self . html )
Return HTML (or other related content) for Meteor.
Return HTML ( or other related content ) for Meteor .