Centos 7 上的发明树

问题描述 投票:0回答:0

过去两天我一直在尝试在 CentOS 7 上安装 InvenTree,当然,因为 CentOS 不符合使用命令 'wget -qO install.sh https://get.inventree.org && bash install.sh',我必须手动安装所有内容。所以,我安装了 Python 3.8,安装了 PostgreSQL,并克隆了 InvenTree 存储库。我遇到了很多问题,但到目前为止没有什么是我解决不了的。无论如何,事不宜迟,我会解释我的问题。

当我运行命令'python3.8 manage.py migrate'时,出现以下错误:

Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 75, in handle
    self.check(databases=[database])
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/management/base.py", line 419, in check
    all_issues = checks.run_checks(
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/urls/resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/urls/resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/InvenTree/InvenTree/InvenTree/InvenTree/urls.py", line 14, in <module>
    from build.api import build_api_urls
  File "/root/InvenTree/InvenTree/InvenTree/build/api.py", line 12, in <module>
    from InvenTree.api import AttachmentMixin, APIDownloadMixin, ListCreateDestroyAPIView, MetadataView, StatusView
  File "/root/InvenTree/InvenTree/InvenTree/InvenTree/api.py", line 22, in <module>
    from .status import is_worker_running
  File "/root/InvenTree/InvenTree/InvenTree/InvenTree/status.py", line 12, in <module>
    from django_q.monitor import Stat
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/django_q/monitor.py", line 4, in <module>
    from blessed import Terminal
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/blessed/__init__.py", line 14, in <module>
    from blessed.terminal import Terminal  # type: ignore
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/blessed/terminal.py", line 21, in <module>
    from .keyboard import (_time_left,
  File "/root/InvenTree/inventree-env/lib/python3.8/site-packages/blessed/keyboard.py", line 19, in <module>
    import curses
  File "/usr/local/lib/python3.8/curses/__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses'

但是,我已经使用命令“sudo yum install python38-devel ncurses-devel”安装了 python38-devel 和 ncurses-devel。可以肯定的是,我还删除了 python 环境并创建了一个新环境:

deactivate
rm -rf inventree-env
python3.8 -m venv inventree-env
source inventree-env/bin/activate
cd InvenTree
pip install -r requirements.txt

我已经安装了缺少的模块之一 psycopg2:'pip install psycopg2' 并且我已经在控制台中定义了用于连接到 PostgreSQL 的环境变量:

export INVENTREE_DB_ENGINE='django.db.backends.postgresql'
export INVENTREE_DB_NAME='InvenTree'
export INVENTREE_DB_USER='MyUser'
export INVENTREE_DB_PASSWORD='MyPassword'
export INVENTREE_DB_HOST='localhost'
export INVENTREE_DB_PORT='5432'

我还在 settings.py 中定义了 Static 和 Media 文件夹的路径,在 config.py 中定义了备份文件夹。

然而,在进行了所有必要的调整之后,我仍然遇到上述错误。

让我给你一些关于路径的更多细节:整个 InvenTree 项目位于 /root 中(我知道这不是很可取,但是......):

(inventree-env) [root@desktop-lk48540-1 InvenTree]# cd /root && ls
anaconda-ks.cfg  downloads  InvenTree  Python-3.8.10  Python-3.8.10.tgz

(inventree-env) [root@desktop-lk48540-1 ~]# cd InvenTree/ && ls
backups  InvenTree  inventree-env

(inventree-env) [root@desktop-lk48540-1 InvenTree]# cd InvenTree/ && ls
ci       CONTRIBUTING.md  deploy  docker-compose.yml  Dockerfile  images     LICENSE       package-lock.json  README.md        RELEASE.md           requirements-dev.txt  requirements.txt  SECURITY.md  tasks.py
contrib  crowdin.yml      docker  docker.dev.env      docs        InvenTree  package.json  Procfile           readthedocs.yml  requirements-dev.in  requirements.in       runtime.txt       setup.cfg

(inventree-env) [root@desktop-lk48540-1 InvenTree]# cd InvenTree/ && ls
build  common  company  config_template.yaml  config.yaml  gunicorn.conf.py  InvenTree  label  locale  manage.py  order  part  plugin  plugins  plugins.txt  report  script  secret_key.txt  stock  templates  users

(inventree-env) [root@desktop-lk48540-1 InvenTree]# cd InvenTree/ && ls
admin.py       api_version.py   config.py      exchange.py  format.py   __init__.py  metadata.py    mixins.py       __pycache__   serializers.py  Static           tasks.py            tests.py       test_views.py  version.py
api.py         apps.py          context.py     fields.py    forms.py    management   middleware.py  models.py       ready.py      settings.py     status_codes.py  test_api.py         test_tasks.py  urls.py        views.py
api_tester.py  ci_render_js.py  exceptions.py  filters.py   helpers.py  Media        migrations     permissions.py  sanitizer.py  static          status.py        test_middleware.py  test_urls.py   validators.py  wsgi.py

有没有人有什么想法可以帮助我?

PS:我很想使用一个很好的旧 Ubuntu 服务器或 Debian 系统,但不幸的是,我别无选择,只能使用 CentOS 7。

预先感谢您的帮助:)

centos7 python-3.8 ncurses
© www.soinside.com 2019 - 2024. All rights reserved.