原本seafile7.0.5服务端安装在debian9.6系统python2.7环境,后改为python为3.5.3升级7.1.5(7.1.5版本要求python3环境)
./seafile.sh ./seahub.都能正常启动,但是网页和客户端软件都无法使用。
错误日志:
Traceback (most recent call last): File “/home/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner response = get_response(request) File “/home/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 244, in _legacy_get_response response = middleware_method(request) File “/home/seafile-server-7.1.5/seahub/thirdpart/django/middleware/locale.py”, line 24, in process_request i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf) File “/home/seafile-server-7.1.5/seahub/thirdpart/django/conf/urls/i18n.py”, line 29, in is_language_prefix_patterns_used for url_pattern in get_resolver(urlconf).url_patterns: File “/home/seafile-server-7.1.5/seahub/thirdpart/django/utils/functional.py”, line 35, in get res = instance.dict[self.name] = self.func(instance) File “/home/seafile-server-7.1.5/seahub/thirdpart/django/urls/resolvers.py”, line 407, in url_patterns patterns = getattr(self.urlconf_module, “urlpatterns”, self.urlconf_module) File “/home/seafile-server-7.1.5/seahub/thirdpart/django/utils/functional.py”, line 35, in get res = instance.dict[self.name] = self.func(instance) File “/home/seafile-server-7.1.5/seahub/thirdpart/django/urls/resolvers.py”, line 400, in urlconf_module return import_module(self.urlconf_name) File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “”, line 986, in _gcd_import File “”, line 969, in _find_and_load File “”, line 958, in _find_and_load_unlocked File “”, line 673, in _load_unlocked File “”, line 673, in exec_module File “”, line 222, in _call_with_frames_removed File “/home/seafile-server-7.1.5/seahub/seahub/utils/rooturl.py”, line 41, in url(r’^%s’ % settings.SITE_ROOT[1:], include(settings.SITE_ROOT_URLCONF)), File “/home/seafile-server-7.1.5/seahub/thirdpart/django/conf/urls/init.py”, line 50, in include urlconf_module = import_module(urlconf_module) File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “”, line 986, in _gcd_import File “”, line 969, in _find_and_load File “”, line 958, in _find_and_load_unlocked File “”, line 673, in _load_unlocked File “”, line 673, in exec_module File “”, line 222, in _call_with_frames_removed File “/home/seafile-server-7.1.5/seahub/seahub/urls.py”, line 8, in from seahub.views.sysadmin import * File “/home/seafile-server-7.1.5/seahub/seahub/views/sysadmin.py”, line 13, in from openpyxl import load_workbook File “/home/seafile-server-7.1.5/seahub/thirdpart/openpyxl/init.py”, line 6, in from openpyxl.workbook import Workbook File “/home/seafile-server-7.1.5/seahub/thirdpart/openpyxl/workbook/init.py”, line 4, in from .workbook import Workbook File “/home/seafile-server-7.1.5/seahub/thirdpart/openpyxl/workbook/workbook.py”, line 7, in from openpyxl.worksheet.worksheet import Worksheet File “/home/seafile-server-7.1.5/seahub/thirdpart/openpyxl/worksheet/worksheet.py”, line 396 return f"{get_column_letter(min_col)}{min_row}:{get_column_letter(max_col)}{max_row} SyntaxError: invalid syntax
升级失败后,重新安装了最新的8.0.2社区版服务端,数据和账号信息还在,只是需要重新登录账号并重新同步资料库。
说一下步骤(系统是debian9.6,默认python2.7.13)(当时升级失败应该是python3的环境没有弄好):
大体思路:备份数据库文件,重新安装最新的8.0.2社区版服务端,恢复数据库。
1.老版本为7.0.5,数据库通过7.1.5及8.0.2安装包依次升级(版本更新后数据库应该有变动过),备份3个数据库
2.使用pyenv管理python环境(安装各版本python及环境切换都很方便),安装及使用参考:https://51.ruyo.net/3708.html
3.使用pyenv安装最新的python3.9.1并切换为默认环境,使用python -V和pip -V确认为3.9.1版本,
4.按照官方教程安装8.0.2(安装依赖的时候会报错,根据错误提醒安装对应的python模块即可)
5.安装步骤到导入seahub数据库的时候会报mysql语法错误,不用管,因为安装程序没有正常结束,需要手动建立seafile-server-latest到seafile-server-8.0.2的软连接,最后删除/tmp/seahub_cache里面缓存文件,
rm /home/seafile-server-latest ln -s /home/seafile-server-8.0.2 seafile-server-latest rm -rf /tmp/seahub_cache/*
6.分别导入3个数据库对应的备份,并将seafile以前的个性化配置文件信息,加进新的配置文件,
7.安装python的mysqlclient模块,否则启动seafile会报错,
pip install mysqlclient
8.如果一切顺利,就可以正常启动seafile和seahub服务,在客户端重新登录同步一下就可以了。
前面升级失败应该是python3环境没有配置好,要是弄好得话,升级应该就没有这么麻烦了,搞了好几天,愁哟。
现在就是担心安装8.0.2过程中那个数据库语法错误对后面使用会有什么影响。。。
本文链接:http://www.bosim.vip/index.php/post/33.html
--EOF--
发表于 2021-01-14 。