lihuacai168 / AnotherFasterRunner

接口自动化测试平台,基于HttpRunner+Python+Django+Vue,已在多家公司落地使用,2018年服役至今
https://fast.huacai.one
MIT License
628 stars 133 forks source link

AttributeError: module 'django.contrib.admin' has no attribute 'action' 帮忙看看 #195

Closed TestOrDev closed 6 months ago

TestOrDev commented 6 months ago

描述问题 执行 docker-compose --env-file=$HOME/.env build app 的时候报错是这个,不知道问题出在哪里了,看了半天了找不到问题,大佬给看看 多谢了 1.348 AttributeError: module 'django.contrib.admin' has no attribute 'action'

bug1

lihuacai168 commented 6 months ago

有点奇怪哦,之前没遇到过。 看看docker和docker-compose版本 @TestOrDev

TestOrDev commented 6 months ago

Docker version 24.0.5, build ced0996 Docker Compose version v2.24.6

lihuacai168 commented 6 months ago

看上去docker没什么问题,我用这个 $ docker --version Docker version 25.0.3, build 4debf41

root @ huacai~/shell [23:22:28]

$ docker-compose --version Docker Compose version v2.17.2

是拉取最新的代码吗

TestOrDev commented 6 months ago

pl-bug1 我把这个注释了 能build成功 但是。最后页面打开会报错。LookupError: No installed app with label 'admin'. 代码是新的 我就加了个断言,不影响

lihuacai168 commented 6 months ago

参考一下哈,我本地构建没问题,CI构建也是正常的

# huacai @ m1max in ~/code/python/AnotherFasterRunner on git:feat/mock-feat x fasterrunner-ru9_cPUx-py3.11 [21:59:32] 
$ docker-compose --env-file .env.example build app
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DJANGO_API_PORT" variable is not set. Defaulting to a blank string. 
[+] Building 96.3s (18/18) FINISHED                                                                                                                                                                                                                                                                docker:orbstack
 => [app internal] load build definition from Dockerfile                                                                                                                                                                                                                                                      0.0s
 => => transferring dockerfile: 2.84kB                                                                                                                                                                                                                                                                        0.0s
 => [app internal] load metadata for docker.io/library/python:3.11-buster                                                                                                                                                                                                                                     1.1s
 => [app internal] load .dockerignore                                                                                                                                                                                                                                                                         0.0s
 => => transferring context: 125B                                                                                                                                                                                                                                                                             0.0s
 => [app base 1/6] FROM docker.io/library/python:3.11-buster@sha256:3a19b4d6ce4402d11bb19aa11416e4a262a60a57707a5cda5787a81285df2666                                                                                                                                                                          0.0s
 => [app internal] load build context                                                                                                                                                                                                                                                                         0.0s
 => => transferring context: 34.78kB                                                                                                                                                                                                                                                                          0.0s
 => CACHED [app base 2/6] RUN pip install poetry                                                                                                                                                                                                                                                              0.0s
 => CACHED [app base 3/6] COPY pyproject.toml poetry.lock ./                                                                                                                                                                                                                                                  0.0s
 => CACHED [app base 4/6] RUN poetry export -f requirements.txt --output requirements.txt --without-hashes                                                                                                                                                                                                    0.0s
 => [app base 5/6] RUN echo "deb http://mirrors.aliyun.com/debian/ buster main contrib non-free" > /etc/apt/sources.list &&     echo "deb-src http://mirrors.aliyun.com/debian/ buster main contrib non-free" >> /etc/apt/sources.list &&     echo "deb http://mirrors.aliyun.com/debian-security buster/upd  0.1s
 => [app base 6/6] RUN apt-get update &&     apt-get install -y python3-dev build-essential netcat-openbsd libpcre3-dev libldap2-dev libsasl2-dev &&     pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple &&     apt-get remove -y python3-dev build-essential libpcre3-dev &&    90.7s
 => CACHED [app stage-1 2/8] RUN echo "deb http://mirrors.aliyun.com/debian/ buster main contrib non-free" > /etc/apt/sources.list &&     echo "deb-src http://mirrors.aliyun.com/debian/ buster main contrib non-free" >> /etc/apt/sources.list &&     echo "deb http://mirrors.aliyun.com/debian-security   0.0s 
 => CACHED [app stage-1 3/8] RUN apt-get update &&     apt-get install -y tzdata &&     ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&     echo Asia/Shanghai > /etc/timezone &&     rm -rf /var/lib/apt/lists/*                                                                                 0.0s 
 => [app stage-1 4/8] COPY --from=Base /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages                                                                                                                                                                                        0.9s 
 => [app stage-1 5/8] WORKDIR /app                                                                                                                                                                                                                                                                            0.0s 
 => [app stage-1 6/8] COPY . /app                                                                                                                                                                                                                                                                             0.0s 
 => [app stage-1 7/8] RUN chmod +x /app/start.sh                                                                                                                                                                                                                                                              0.1s 
 => [app stage-1 8/8] RUN python manage.py collectstatic --settings=FasterRunner.settings.docker --no-input                                                                                                                                                                                                   1.2s
 => [app] exporting to image                                                                                                                                                                                                                                                                                  1.4s
 => => exporting layers                                                                                                                                                                                                                                                                                       1.4s
 => => writing image sha256:5354c97db0bdc93fb466ce009610f362bceaa282ecb0a670a82a35783cd426ba                                                                                                                                                                                                                  0.0s
 => => naming to docker.io/library/fasterrunner_app:latest                                                                                                                                                                                                                                                    0.0s
(fasterrunner-py3.11) 
# huacai @ m1max in ~/code/python/AnotherFasterRunner on git:feat/mock-feat x fasterrunner-ru9_cPUx-py3.11 [22:03:04] 
$ docker-compose --version                        
Docker Compose version 2.24.6
(fasterrunner-py3.11) 
# huacai @ m1max in ~/code/python/AnotherFasterRunner on git:feat/mock-feat x fasterrunner-ru9_cPUx-py3.11 [22:03:15] 
$ 
(fasterrunner-py3.11) 
# huacai @ m1max in ~/code/python/AnotherFasterRunner on git:feat/mock-feat x fasterrunner-ru9_cPUx-py3.11 [22:03:16] 
$ docker --version        

Docker version 25.0.3, build 4debf41
(fasterrunner-py3.11) 
# huacai @ m1max in ~/code/python/AnotherFasterRunner on git:feat/mock-feat x fasterrunner-ru9_cPUx-py3.11 [22:03:24] 
lihuacai168 commented 6 months ago

应该是python3.9有问题,使用python3.11就OK了,麻烦试一下,没问题就关了issue @TestOrDev

TestOrDev commented 6 months ago

是3.9的问题,不兼容,得用10以上