gpt4 book ai didi

在 docker 中运行时出现 Django 段错误

转载 作者:行者123 更新时间:2023-12-02 18:29:30 27 4
gpt4 key购买 nike

在 docker 中运行应用程序时出现段错误

/path/condapy/envs/env_name/bin/python -vvvvvv manage.py runserver


# code object from
'/path/condapy/envs/env_name/lib/python3.6/site-packages/django/core/__pycache__/wsgi.cpython-36.pyc'
import 'django.core.wsgi' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919dd5a90>
import 'django.core.servers.basehttp' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919dca240>
import 'django.core.management.commands.runserver' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919dbf630>
import 'django.contrib.staticfiles.management.commands.runserver' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919db34a8>
PyThreadState_Clear: warning: thread still has a frame
Running in local mode
Performing system checks...

Segmentation fault

Dockerfile
FROM centos:latest

ENV JAVA_VERSON=1.8.0 \
JAVA_HOME=/usr/lib/jvm/java \
codepath=<>

RUN yum install -y epel-release cmake wget git python-setuptools zlib-devel openssl-devel python-devel gcc-c++ snappy-devel gcc curl bzip2 java-$JAVA_VERSON-openjdk java-$JAVA_VERSON-openjdk-devel && \
yum install -y nginx && \
easy_install supervisor && \
yum clean all && \
rm -rf /etc/localtime && \
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime && \
mkdir -p /logs

RUN mkdir -p /path/condapy && \
curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /srv/miniconda.sh && \
bash /srv/miniconda.sh -bfp /path/condapy && \
/path/condapy/bin/conda install -y python=3 && \
/path/condapy/bin/conda update conda && \
/path/condapy/bin/conda clean --all --yes

EXPOSE 80

WORKDIR /app_path

ARG aws_access_key_id
ARG aws_secret_access_key
ARG env

COPY ./conda_environment.yml /app_path/conda_environment.yml

RUN /path/condapy/bin/conda config --add channels conda-forge && \
/path/condapy/bin/conda env create -f=/app_path/conda_environment.yml -n chatty && \
rm -rf /opt/conda/pkgs/*

COPY ./ $codepath

CMD ["/usr/bin/supervisord", "-n"]

数据库配置看起来不错,我们已经分配了足够的内存。有什么建议么?

最佳答案

在构建 docker 镜像时安装 python。尝试使用预安装的 python 从 centos 镜像构建镜像或从多个基础镜像构建镜像(docker 自 17.05 起支持 https://docs.docker.com/develop/develop-images/multistage-build/#before-multi-stage-builds )

你的 Dockerfile 会变成这样:

# Include Base image with preinstalled python 
######
FROM centos/python-35-centos7
pip install ...
######

ENV JAVA_VERSON=1.8.0 \
JAVA_HOME=/usr/lib/jvm/java \
codepath=<>
......

关于在 docker 中运行时出现 Django 段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51511629/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com