odoo在Windows平台下部署无内容显示问题

来源:互联网 发布:php 字符串查找函数 编辑:程序博客网 时间:2024/05/29 18:15

odoo在Windows平台下部署无内容显示问题

问题描述:在Windows下部署oddo10在数据库建立后仅显示背景与logo

解决方法:

打开注册表

修改.js的默认Content Type配置

将.js的Content Type修改为application/javascript (小写)

切记修改完成后一定要重新创建数据库以及删除浏览器缓存


以下是相关原因

文件名:mimetypes.py

    def read_windows_registry(self, strict=True):        """        Load the MIME types database from Windows registry.        If strict is true, information will be added to        list of standard types, else to the list of non-standard        types.        """        # Windows only        if not _winreg:            return        def enum_types(mimedb):            i = 0            while True:                try:                    ctype = _winreg.EnumKey(mimedb, i)                except EnvironmentError:                    break                else:                    if '\0' not in ctype:                        yield ctype                i += 1        default_encoding = sys.getdefaultencoding()        with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr:            for subkeyname in enum_types(hkcr):                try:                    with _winreg.OpenKey(hkcr, subkeyname) as subkey:                        # Only check file extensions                        if not subkeyname.startswith("."):                            continue                        # raises EnvironmentError if no 'Content Type' value                        mimetype, datatype = _winreg.QueryValueEx(                            subkey, 'Content Type')                        if datatype != _winreg.REG_SZ:                            continue                        try:                            mimetype = mimetype.encode(default_encoding)                        except UnicodeEncodeError:                            continue                        self.add_type(mimetype, subkeyname, strict)                except EnvironmentError:                    continue

odoo服务器要求浏览器严格验证mimetype,windows平台下odoo在此处进行了注册表查询,并对模块内原有的mimetype映射做了覆盖,导致mimetype变为了text/plain,导致浏览器mimetype验证不通过,所以无法正常显示页面。

原创粉丝点击