api.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:kolibri 作者: learningequality 项目源码 文件源码
def get(self, request, format=None):
        info = {}

        info['version'] = kolibri.__version__

        status, urls = get_urls()
        if not urls:
            # Will not return anything when running the debug server, so at least return the current URL
            urls = [request.build_absolute_uri('/')]

        filtered_urls = [url for url in urls if '127.0.0.1' not in url and 'localhost' not in url]

        if filtered_urls:
            urls = filtered_urls

        info['urls'] = urls

        if settings.DATABASES['default']['ENGINE'].endswith('sqlite3'):
            # If any other database backend, will not be file backed, so no database path to return
            info['database_path'] = settings.DATABASES['default']['NAME']

        instance_model = InstanceIDModel.get_or_create_current_instance()[0]

        info['device_name'] = instance_model.hostname
        info['device_id'] = instance_model.id
        info['os'] = instance_model.platform

        info['content_storage_free_space'] = get_free_space()

        # This returns the localized time for the server
        info['server_time'] = local_now()
        # Returns the named timezone for the server (the time above only includes the offset)
        info['server_timezone'] = settings.TIME_ZONE

        return Response(info)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号