python 自动化测试框架 automagic 搭建

一、基础环境准备

参照文章  https://www.cnblogs.com/ningy1009/p/13594586.html

二、下载源码

https://github.com/radiateboy/automagic

三、安装所需的包

cd automagic

pip3 install -r requirements/base.txt

3.1 不出意料的出现了错误

[root@kycxnode111 automagic-master]# pip3 install -r requirements/base.txt
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/django/
Collecting django>=3.0.6
  Downloading Django-3.1-py3-none-any.whl (7.8 MB)
     |████████████████████████████████| 7.8 MB 14 kB/s
Collecting mysqlclient==1.4.6
  Downloading mysqlclient-1.4.6.tar.gz (85 kB)
     |████████████████████████████████| 85 kB 21 kB/s
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i0lxwjtl/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-i0lxwjtl/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-a2h18k65
         cwd: /tmp/pip-install-i0lxwjtl/mysqlclient/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 19, in <module>
        from setuptools.dist import Distribution
      File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 34, in <module>
        from setuptools import windows_support
      File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python3.8 -m pip install --upgrade pip' command.
[root@kycxnode111 automagic-master]# pip3 install --upgrade setuptools
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
Collecting setuptools
  Downloading setuptools-50.0.0-py3-none-any.whl (783 kB)
     |████████████████████████████████| 783 kB 54 kB/s
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 47.1.0
    Uninstalling setuptools-47.1.0:
      Successfully uninstalled setuptools-47.1.0
Successfully installed setuptools-50.0.0
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python3.8 -m pip install --upgrade pip' command.
[root@kycxnode111 automagic-master]# /usr/local/bin/python3.8 -m pip install --upgrade pip
Collecting pip
  Downloading pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 57 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1.1
    Uninstalling pip-20.1.1:
      Successfully uninstalled pip-20.1.1
Successfully installed pip-20.2.2
[root@kycxnode111 automagic-master]#

 

3.1.2 解决办法执行 提示的语句,以及更新 setuptools

/usr/local/bin/python3.8 -m pip install --upgrade pip
 pip3 install --upgrade setuptools

3.2.3 运行后发现还是报错

 3.2.4 查阅一番资料后 解决办法

 1 [root@kycxnode111 automagic-master]# yum install libffi-devel
 2 已加载插件:fastestmirror
 3 Loading mirror speeds from cached hostfile
 4  * base: mirror.bit.edu.cn
 5  * epel: d2lzkl7pfhq30w.cloudfront.net
 6  * extras: mirror.bit.edu.cn
 7  * updates: mirrors.aliyun.com
 8 正在解决依赖关系
 9 --> 正在检查事务
10 ---> 软件包 libffi-devel.x86_64.0.3.0.13-19.el7 将被 安装
11 --> 解决依赖关系完成
12 
13 依赖关系解决
14 
15 ============================================================================================================
16  Package                     架构                  版本                           源                   大小
17 ============================================================================================================
18 正在安装:
19  libffi-devel                x86_64                3.0.13-19.el7                  base                 23 k
20 
21 事务概要
22 ============================================================================================================
23 安装  1 软件包
24 
25 总下载量:23 k
26 安装大小:27 k
27 Is this ok [y/d/N]: y
28 Downloading packages:
29 libffi-devel-3.0.13-19.el7.x86_64.rpm                                                |  23 kB  00:00:05
30 Running transaction check
31 Running transaction test
32 Transaction test succeeded
33 Running transaction
34   正在安装    : libffi-devel-3.0.13-19.el7.x86_64                                                       1/1
35   验证中      : libffi-devel-3.0.13-19.el7.x86_64                                                       1/1
36 
37 已安装:
38   libffi-devel.x86_64 0:3.0.13-19.el7
39 
40 完毕!

3.2.5 再次执行 重新安装python3.8

  https://www.cnblogs.com/ningy1009/p/13594586.html

但是在make 的过程就报错了

3.2.6 再执行以下命令

yum update
yum upgradeyum install  python-setuptools python-pip yum install  openssl
yum install libffi-devel
[root@kycxnode111 Python-3.8.5]# yum update
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 bind-export-libs.x86_64.32.9.11.4-16.P2.el7_8.3 将被 升级
---> 软件包 bind-export-libs.x86_64.32.9.11.4-16.P2.el7_8.6 将被 更新
---> 软件包 bind-libs-lite.x86_64.32.9.11.4-16.P2.el7_8.3 将被 升级
---> 软件包 bind-libs-lite.x86_64.32.9.11.4-16.P2.el7_8.6 将被 更新
---> 软件包 bind-license.noarch.32.9.11.4-16.P2.el7_8.3 将被 升级
---> 软件包 bind-license.noarch.32.9.11.4-16.P2.el7_8.6 将被 更新
---> 软件包 ca-certificates.noarch.0.2019.2.32-76.el7_7 将被 升级
---> 软件包 ca-certificates.noarch.0.2020.2.41-70.0.el7_8 将被 更新
---> 软件包 container-selinux.noarch.2.2.119.1-1.c57a6f9.el7 将被 升级
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 更新
---> 软件包 curl.x86_64.0.7.29.0-57.el7 将被 升级
---> 软件包 curl.x86_64.0.7.29.0-57.el7_8.1 将被 更新
---> 软件包 dbus.x86_64.1.1.10.24-13.el7_6 将被 升级
---> 软件包 dbus.x86_64.1.1.10.24-14.el7_8 将被 更新
---> 软件包 dbus-libs.x86_64.1.1.10.24-13.el7_6 将被 升级

3.2.7 发现在安装的过程中有一句Delta RPMs disabled because /usr/bin/applydeltarpm not installed

字面翻译就是deltarpm没有安装,这个会导致mysql 安装失败

接下来我们安装就是了执行两条命令

yum provides '*/applydeltarpm'    #查看依赖包的位置
yum -y  install deltarpm             #安装命令
[root@kycxnode111 Python-3.8.5]# yum provides '*/applydeltarpm'
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base/7/x86_64/filelists_db                                                                                                       | 7.1 MB  00:00:02
docker-ce-stable/x86_64/filelists_db                                                                                             |  21 kB  00:00:00
epel/x86_64/filelists_db                                                                                                         |  12 MB  00:00:09
extras/7/x86_64/filelists_db                                                                                                     | 217 kB  00:00:00
updates/7/x86_64/filelists_db                                                                                                    | 2.4 MB  00:00:00
deltarpm-3.6-3.el7.x86_64 : Create deltas between rpms
源    :base
匹配来源:
文件名    :/usr/bin/applydeltarpm
[root@kycxnode111 Python-3.8.5]# yum -y  install deltarpm
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 deltarpm.x86_64.0.3.6-3.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

========================================================================================================================================================
 Package                              架构                               版本                                    源                                大小
========================================================================================================================================================
正在安装:
 deltarpm                             x86_64                             3.6-3.el7                               base                              82 k

事务概要
========================================================================================================================================================
安装  1 软件包

总下载量:82 k
安装大小:209 k
Downloading packages:
deltarpm-3.6-3.el7.x86_64.rpm                                                                                                    |  82 kB  00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : deltarpm-3.6-3.el7.x86_64                                                                                                           1/1
  验证中      : deltarpm-3.6-3.el7.x86_64                                                                                                           1/1

已安装:
  deltarpm.x86_64 0:3.6-3.el7

完毕!

3.2.8 至此在进行python 的安装 依次执行

./configure prefix=/usr/local/python3
make && make altinstall
至此上面的问题解决继续安装项目所需要的的包

3.2.9 执行  pip3 install -r requirements/base.txt

[root@kycxnode111 automagic-master]# pip3 install -r requirements/base.txt
Collecting django>=3.0.6
  Using cached Django-3.1-py3-none-any.whl (7.8 MB)
Collecting mysqlclient==1.4.6
  Using cached mysqlclient-1.4.6.tar.gz (85 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/python3/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qknshfee/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qknshfee/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-0j9b8cd6
         cwd: /tmp/pip-install-qknshfee/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: 未找到命令
    /bin/sh: mariadb_config: 未找到命令
    /bin/sh: mysql_config: 未找到命令
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-qknshfee/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-qknshfee/mysqlclient/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-qknshfee/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
发现报错

查阅得知 在linux上安装 mysqlclint 的时候需要安装相关依赖 mysql-devel:

yum install mysql-devel
 1 [root@kycxnode111 automagic-master]# yum install mysql-devel
 2 已加载插件:fastestmirror
 3 Loading mirror speeds from cached hostfile
 4  * base: mirrors.aliyun.com
 5  * epel: d2lzkl7pfhq30w.cloudfront.net
 6  * extras: mirrors.aliyun.com
 7  * updates: mirrors.aliyun.com
 8 正在解决依赖关系
 9 --> 正在检查事务
10 ---> 软件包 mariadb-devel.x86_64.1.5.5.65-1.el7 将被 安装
11 --> 解决依赖关系完成
12 
13 依赖关系解决
14 
15 ===============================================================================================================================================================================================================
16  Package                                              架构                                          版本                                                     源                                           大小
17 ===============================================================================================================================================================================================================
18 正在安装:
19  mariadb-devel                                        x86_64                                        1:5.5.65-1.el7                                           base                                        756 k
20 
21 事务概要
22 ===============================================================================================================================================================================================================
23 安装  1 软件包
24 
25 总下载量:756 k
26 安装大小:3.3 M
27 Is this ok [y/d/N]: y
28 Downloading packages:
29 mariadb-devel-5.5.65-1.el7.x86_64.rpm                                                                                                                                                   | 756 kB  00:00:00
30 Running transaction check
31 Running transaction test
32 Transaction test succeeded
33 Running transaction
34   正在安装    : 1:mariadb-devel-5.5.65-1.el7.x86_64                                                                                                                                                        1/1
35   验证中      : 1:mariadb-devel-5.5.65-1.el7.x86_64                                                                                                                                                        1/1
36 
37 已安装:
38   mariadb-devel.x86_64 1:5.5.65-1.el7

继续执行发现又报错了

[root@kycxnode111 automagic-master]# pip3 install -r requirements/base.txt
Collecting django>=3.0.6
  Using cached Django-3.1-py3-none-any.whl (7.8 MB)
Collecting mysqlclient==1.4.6
  Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Collecting testrail==0.3.12
  Downloading testrail-0.3.12.tar.gz (15 kB)
Collecting python-jenkins==1.6.0
  Downloading python_jenkins-1.6.0-py2.py3-none-any.whl (27 kB)
Collecting requests==2.22.0
  Downloading requests-2.22.0-py2.py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 17 kB/s
ERROR: Could not find a version that satisfies the requirement nameko==2.12.0 (from -r requirements/base.txt (line 6)) (from versions: none)
ERROR: No matching distribution found for nameko==2.12.0 (from -r requirements/base.txt (line 6))

进入 https://pypi.org/project/nameko/  查看确实最新的版本就是 2.12.0 但是为何不能安装成功所以

base.txt 中的 nameko==2.12.0 注释,打算用pip 单独安装

发现又报错了

 故修改base.txt  将 testrail 版本调至最新

Using legacy 'setup.py install' for mysqlclient, since package 'wheel' is not installed.
Using legacy 'setup.py install' for testrail, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyyaml, since package 'wheel' is not installed.
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Using legacy 'setup.py install' for multi-key-dict, since package 'wheel' is not installed.
Installing collected packages: asgiref, pytz, sqlparse, django, mysqlclient, certifi, idna, chardet, requests, six, singledispatch, pyyaml, future, decorator, py, retry, testrail, pbr, multi-key-dict, python-jenkins
    Running setup.py install for mysqlclient ... done
    Running setup.py install for pyyaml ... done
    Running setup.py install for future ... done
    Running setup.py install for testrail ... done
    Running setup.py install for multi-key-dict ... done
Successfully installed asgiref-3.2.10 certifi-2020.6.20 chardet-3.0.4 decorator-4.4.2 django-3.1 future-0.18.2 idna-2.8 multi-key-dict-2.0.3 mysqlclient-1.4.6 pbr-5.4.5 py-1.9.0 python-jenkins-1.6.0 pytz-2020.1 pyyaml-5.3.1 requests-2.22.0 retry-0.9.2 singledispatch-3.4.0.3 six-1.15.0 sqlparse-0.3.1 testrail-0.3.13
[root@kycxnode111 requirements]# pip3 install wheel
Collecting wheel
  Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: wheel
Successfully installed wheel-0.35.1

安装上面的 nameko

[root@kycxnode111 requirements]# pip3 install nameko
Collecting nameko
  Downloading nameko-2.12.0-py2.py3-none-any.whl (74 kB)
     |████████████████████████████████| 74 kB 136 kB/s
Requirement already satisfied: pyyaml>=5.1 in /usr/local/python3/lib/python3.8/site-packages (from nameko) (5.3.1)
Collecting eventlet>=0.20.1
  Downloading eventlet-0.26.1-py2.py3-none-any.whl (223 kB)
     |████████████████████████████████| 223 kB 46 kB/s
Requirement already satisfied: six>=1.9.0 in /usr/local/python3/lib/python3.8/site-packages (from nameko) (1.15.0)
Collecting werkzeug>=0.9
  Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
     |████████████████████████████████| 298 kB 62 kB/s
Requirement already satisfied: requests>=1.2.0 in /usr/local/python3/lib/python3.8/site-packages (from nameko) (2.22.0)
Collecting path.py>=6.2
  Downloading path.py-12.5.0-py3-none-any.whl (2.3 kB)
Collecting mock>=1.2
  Downloading mock-4.0.2-py3-none-any.whl (28 kB)
Collecting wrapt>=1.0.0
  Downloading wrapt-1.12.1.tar.gz (27 kB)
Collecting kombu<5,>=4.2.0
  Downloading kombu-4.6.11-py2.py3-none-any.whl (184 kB)
     |████████████████████████████████| 184 kB 69 kB/s
Collecting dnspython<2.0.0,>=1.15.0
  Downloading dnspython-1.16.0-py2.py3-none-any.whl (188 kB)
     |████████████████████████████████| 188 kB 59 kB/s
ERROR: Could not find a version that satisfies the requirement greenlet>=0.3 (from eventlet>=0.20.1->nameko) (from versions: none)
ERROR: No matching distribution found for greenlet>=0.3 (from eventlet>=0.20.1->nameko)
[root@kycxnode111 requirements]#

这里还是有错误

安装 pip3 install greenlet

[root@kycxnode111 requirements]# pip3 install greenlet
Collecting greenlet
  Downloading greenlet-0.4.16-cp38-cp38-manylinux1_x86_64.whl (48 kB)
     |████████████████████████████████| 48 kB 6.1 kB/s
Installing collected packages: greenlet
Successfully installed greenlet-0.4.16

在进行  pip3 install nameko

[root@kycxnode111 requirements]# pip3 install nameko
Collecting nameko
  Using cached nameko-2.12.0-py2.py3-none-any.whl (74 kB)
Requirement already satisfied: requests>=1.2.0 in /usr/local/python3/lib/python3.8/site-packages (from nameko) (2.22.0)
Collecting path.py>=6.2
  Using cached path.py-12.5.0-py3-none-any.whl (2.3 kB)
Collecting mock>=1.2
  Using cached mock-4.0.2-py3-none-any.whl (28 kB)
Requirement already satisfied: six>=1.9.0 in /usr/local/python3/lib/python3.8/site-packages (from nameko) (1.15.0)
Requirement already satisfied: pyyaml>=5.1 in /usr/local/python3/lib/python3.8/site-packages (from nameko) (5.3.1)
Collecting werkzeug>=0.9
  Using cached Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
Collecting wrapt>=1.0.0
  Using cached wrapt-1.12.1.tar.gz (27 kB)
Collecting eventlet>=0.20.1
  Using cached eventlet-0.26.1-py2.py3-none-any.whl (223 kB)
Collecting kombu<5,>=4.2.0
  Using cached kombu-4.6.11-py2.py3-none-any.whl (184 kB)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/python3/lib/python3.8/site-packages (from requests>=1.2.0->nameko) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/python3/lib/python3.8/site-packages (from requests>=1.2.0->nameko) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/python3/lib/python3.8/site-packages (from requests>=1.2.0->nameko) (2020.6.20)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/python3/lib/python3.8/site-packages (from requests>=1.2.0->nameko) (1.25.10)
Collecting path
  Downloading path-15.0.0-py3-none-any.whl (21 kB)
Collecting monotonic>=1.4
  Downloading monotonic-1.5-py2.py3-none-any.whl (5.3 kB)
Requirement already satisfied: greenlet>=0.3 in /usr/local/python3/lib/python3.8/site-packages (from eventlet>=0.20.1->nameko) (0.4.16)
Collecting dnspython<2.0.0,>=1.15.0
  Using cached dnspython-1.16.0-py2.py3-none-any.whl (188 kB)
Collecting amqp<2.7,>=2.6.0
  Downloading amqp-2.6.1-py2.py3-none-any.whl (48 kB)
     |████████████████████████████████| 48 kB 1.3 kB/s
Collecting vine<5.0.0a1,>=1.1.3
  Downloading vine-1.3.0-py2.py3-none-any.whl (14 kB)
Building wheels for collected packages: wrapt
  Building wheel for wrapt (setup.py) ... done
  Created wheel for wrapt: filename=wrapt-1.12.1-cp38-cp38-linux_x86_64.whl size=72407 sha256=f67984eaa901b1bb29719c63bd7a675a9630b74386ef19543f37d1c05164e2d3
  Stored in directory: /root/.cache/pip/wheels/5f/fd/9e/b6cf5890494cb8ef0b5eaff72e5d55a70fb56316007d6dfe73
Successfully built wrapt
Installing collected packages: path, path.py, mock, werkzeug, wrapt, monotonic, dnspython, eventlet, vine, amqp, kombu, nameko
Successfully installed amqp-2.6.1 dnspython-1.16.0 eventlet-0.26.1 kombu-4.6.11 mock-4.0.2 monotonic-1.5 nameko-2.12.0 path-15.0.0 path.py-12.5.0 vine-1.3.0 werkzeug-1.0.1 wrapt-1.12.1
[root@kycxnode111 requirements]#

终于至此,base.txt 中的包都安装成功

接下来安装 seleniumreq.txt 中的包

[root@kycxnode111 requirements]# pip3 install -r seleniumreq.txt
Requirement already satisfied: selenium==3.141.0 in /usr/local/python3/lib/python3.8/site-packages (from -r seleniumreq.txt (line 1)) (3.141.0)
Collecting paramiko==2.7.1
  Using cached paramiko-2.7.1-py2.py3-none-any.whl (206 kB)
Collecting scapy==2.4.3
  Downloading scapy-2.4.3.tar.gz (905 kB)
     |████████████████████████████████| 905 kB 54 kB/s
Requirement already satisfied: urllib3 in /usr/local/python3/lib/python3.8/site-packages (from selenium==3.141.0->-r seleniumreq.txt (line 1)) (1.25.10)
Collecting pynacl>=1.0.1
  Downloading PyNaCl-1.4.0-cp35-abi3-manylinux1_x86_64.whl (961 kB)
     |████████████████████████████████| 961 kB 61 kB/s
Collecting cryptography>=2.5
  Downloading cryptography-3.1-cp35-abi3-manylinux2010_x86_64.whl (2.6 MB)
     |████████████████████████████████| 2.6 MB 56 kB/s
Collecting bcrypt>=3.1.3
  Downloading bcrypt-3.2.0-cp36-abi3-manylinux2010_x86_64.whl (63 kB)
     |████████████████████████████████| 63 kB 98 kB/s
Requirement already satisfied: six in /usr/local/python3/lib/python3.8/site-packages (from pynacl>=1.0.1->paramiko==2.7.1->-r seleniumreq.txt (line 2)) (1.15.0)
ERROR: Could not find a version that satisfies the requirement cffi>=1.4.1 (from pynacl>=1.0.1->paramiko==2.7.1->-r seleniumreq.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for cffi>=1.4.1 (from pynacl>=1.0.1->paramiko==2.7.1->-r seleniumreq.txt (line 2))

也有报错,跟之前的方法一样单独进行安装

[root@kycxnode111 requirements]# pip3 install cffi
Collecting cffi
  Downloading cffi-1.14.2-cp38-cp38-manylinux1_x86_64.whl (410 kB)
     |████████████████████████████████| 410 kB 285 kB/s
Collecting pycparser
  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Installing collected packages: pycparser, cffi
Successfully installed cffi-1.14.2 pycparser-2.20
[root@kycxnode111 requirements]# pip3 install -r seleniumreq.txt
Requirement already satisfied: selenium==3.141.0 in /usr/local/python3/lib/python3.8/site-packages (from -r seleniumreq.txt (line 1)) (3.141.0)
Collecting paramiko==2.7.1
  Using cached paramiko-2.7.1-py2.py3-none-any.whl (206 kB)
Collecting scapy==2.4.3
  Using cached scapy-2.4.3.tar.gz (905 kB)
Requirement already satisfied: urllib3 in /usr/local/python3/lib/python3.8/site-packages (from selenium==3.141.0->-r seleniumreq.txt (line 1)) (1.25.10)
Collecting cryptography>=2.5
  Using cached cryptography-3.1-cp35-abi3-manylinux2010_x86_64.whl (2.6 MB)
Collecting bcrypt>=3.1.3
  Using cached bcrypt-3.2.0-cp36-abi3-manylinux2010_x86_64.whl (63 kB)
Collecting pynacl>=1.0.1
  Using cached PyNaCl-1.4.0-cp35-abi3-manylinux1_x86_64.whl (961 kB)
Requirement already satisfied: six>=1.4.1 in /usr/local/python3/lib/python3.8/site-packages (from cryptography>=2.5->paramiko==2.7.1->-r seleniumreq.txt (line 2)) (1.15.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/python3/lib/python3.8/site-packages (from cryptography>=2.5->paramiko==2.7.1->-r seleniumreq.txt (line 2)) (1.14.2)
Requirement already satisfied: pycparser in /usr/local/python3/lib/python3.8/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.5->paramiko==2.7.1->-r seleniumreq.txt (line 2)) (2.20)
Building wheels for collected packages: scapy
  Building wheel for scapy (setup.py) ... done
  Created wheel for scapy: filename=scapy-2.4.3-py2.py3-none-any.whl size=1043873 sha256=9ba92d890694a171de5f267b086e37856548afa7fe7bd882a634b5adc54f30e9
  Stored in directory: /root/.cache/pip/wheels/ba/ea/a0/1bdfccbb1d149c27478f8707dbbf4a6d95bb0d480651f323a7
Successfully built scapy
Installing collected packages: cryptography, bcrypt, pynacl, paramiko, scapy
Successfully installed bcrypt-3.2.0 cryptography-3.1 paramiko-2.7.1 pynacl-1.4.0 scapy-2.4.3
[root@kycxnode111 requirements]#

Mysql/Mariadb 数据库 automatic/settings/common.py

DATABASES = {
    'default': {
        # 'ENGINE': 'django.db.backends.sqlite3',
        # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        'ENGINE':'django.db.backends.mysql',
        'NAME':'automatic',
        'USER':'root',
        'PASSWORD':'123456',
        'HOST':'127.0.0.1',
        'PORT':'3306'
    }
}

数据库初始化

python3 init_database.py


python3 manage.py makemigrations

python3 manage.py migrate

python3 manage.py loaddata initial_data.json
[root@kycxnode111 automagic-master]# ls
auto_auth  automatic  Dockerfile  init_database.py  insertkeyword.sql  LICENSE  manage.py  README.md  requirements  seleniumkeyword  公众号.jpg
[root@kycxnode111 automagic-master]# python3 init_database.py
[root@kycxnode111 automagic-master]# cd automatic/
[root@kycxnode111 automatic]# ls
asgi.py  element  __init__.py  keywords  management  settings  signals.py  static  templates  testcase  testtask  urls.py  webinterface  wsgi.py
[root@kycxnode111 automatic]# cd ../
[root@kycxnode111 automagic-master]# ls
auto_auth  automatic  Dockerfile  init_database.py  insertkeyword.sql  LICENSE  manage.py  README.md  requirements  seleniumkeyword  公众号.jpg
[root@kycxnode111 automagic-master]# python3 manage.py makemigrations
Migrations for 'auto_auth':
  auto_auth/migrations/0002_auto_20200901_1552.py
    - Alter field first_name on user
Migrations for 'testcase':
  automatic/testcase/migrations/0002_delete_caseset.py
    - Delete model Caseset
[root@kycxnode111 automagic-master]# python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, auto_auth, contenttypes, element, keywords, management, sessions, testcase, testtask, webinterface
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auto_auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying auto_auth.0002_auto_20200901_1552... OK
  Applying management.0001_initial... OK
  Applying element.0001_initial... OK
  Applying keywords.0001_initial... OK
  Applying sessions.0001_initial... OK
  Applying testcase.0001_initial... OK
  Applying testcase.0002_delete_caseset... OK
  Applying testtask.0001_initial... OK
  Applying webinterface.0001_initial... OK
[root@kycxnode111 automagic-master]#

创建管理员用户

python3 manage.py createsuperuser
python3 manage.py runserver 0.0.0.0:8000
http://127.0.0.1:8000 访问登录即可
 
原文地址:https://www.cnblogs.com/ningy1009/p/13597334.html