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('"'"'\r\n'"'"', '"'"'\n'"'"');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('"'"'\r\n'"'"', '"'"'\n'"'"');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 訪問登錄即可

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM