CMDB资产管理平台idcops搭建

考虑到IDC多机房,大量资产管理起来比较麻烦,于是便想上平台,在github上看到django-idcops还不错,但是没有详细的安装步骤,于是整理了下搭建过程,以及过程中遇到的问题。

git地址 :https://github.com/Wenvki/django-idcops

作者博客:https://www.iloxp.com/

环境:

系统:Centos7.6

PY:python3.8.2

文章目录:

  一、python安装及设置

  二、环境设置

  三、拉取git代码

安装过程中遇到的问题参考附录1

 

 

一、python安装及设置

1、py安装

wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz

然后进目录编译安装

mkdir /usr/local/python3

./configure --prefix=/usr/local/python3

make && make install 

2、pip源更换

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

pip install --upgrade pip

# 豆瓣
https://pypi.doubanio.com/simple/
# 阿里云
https://mirrors.aliyun.com/pypi/simple/
# 清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/

 

二、环境设置

添加软链接:

ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip

ln -s /usr/local/python3/bin/python3.8  /usr/bin/python

修改yum配置

 vi /usr/bin/yum

#!/usr/bin/python" 改为 "#!/usr/bin/python2.7"

 三、拉取git代码

git clone https://gitee.com/wenvki/django-idcops.git idcops
cd idcops/
virtualenv -p /usr/local/python3/bin/python3 env  ###virtualenv安装:pip install virtualenv
source env/bin/activate
pip install -U pip -i https://mirrors.aliyun.com/pypi/simple/ 
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/   ###如果出现django版本报错,检查python版本,必须要是python3
python manage.py migrate
python manage.py runserver 0.0.0.0:8000

 

附录1

问题:ModuleNotFoundError: No module named '_sqlite3'

yum安装sqlite3.so的库

yum install sqlite* 

然后重新编译安装 python3

 

问题:make migrate时出现报错,

把/idcops/idcops/migrations 目录删掉,然后重新 python manage.py migrate

(env) [root@localhost mysite]# python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/root/mysite/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/root/mysite/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/mysite/env/lib/python3.8/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/mysite/env/lib/python3.8/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/root/mysite/env/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/root/mysite/env/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 82, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/loader.py", line 273, in build_graph
    raise exc
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/loader.py", line 247, in build_graph
    self.graph.validate_consistency()
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/graph.py", line 243, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/graph.py", line 243, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/root/mysite/env/lib/python3.8/site-packages/django/db/migrations/graph.py", line 96, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration idcops.0001_initial dependencies reference nonexistent parent node ('auth', '0011_update_proxy_permissions')

  

posted @ 2020-04-15 16:43  运维军火库  阅读(1902)  评论(0编辑  收藏  举报