我也遇到了同样的问题,请官方支持,谢谢! # 本地容器Start之后: 'HOST': os.environ.get("MYSQL_ADDRESS").split(':')[0], AttributeError: 'NoneType' object has no attribute 'split' 终端进程“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command docker run --rm -t --network wxcb0 --name wxcloud_wxcloudrun-django -l role=container -l wxcloud=wxcloudrun-django -l hostPort=27081 -l wxPort=27082 -p 127.0.0.1:27081:8080/tcp --cpus 1 -m 2GB --mount type=bind,source="C:\Users\aorui\.wxcloudbase\.tencentcloudbase",target=/.tencentcloudbase,readonly wxcloud_wxcloudrun-django:latest”已终止,退出代码: 1。 # docker-compose.yml version: '3' services: app: build: context: . dockerfile: Dockerfile.development volumes: - .:/app ports: - '27081:80' container_name: wxcloud_wxcloudrun-django labels: - wxPort=27082 - hostPort=27081 - wxcloud=wxcloudrun-django - role=container environment: - MYSQL_USERNAME="root" # 我的 - MYSQL_PASSWORD="aoruiDB123" # 我的 - MYSQL_ADDRESS="10.5.110.238:3306" # 我的 networks: default: external: name: wxcb0
初次试用云托管,使用django模板做一个计数器,总是报错部署不了,为什么呢?出现错误的地方如图: File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 82, in __getattr__ self._setup(name) File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 69, in _setup self._wrapped = Settings(settings_module) File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 170, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 848, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/app/wxcloudrun/settings.py", line 73, in <module> 'HOST': os.environ.get("MYSQL_ADDRESS").split(':')[0], AttributeError: 'NoneType' object has no attribute 'split' 检查了下对应的源代码 # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': os.environ.get("MYSQL_DATABASE", 'django_demo'), 'USER': os.environ.get("MYSQL_USERNAME"), 'HOST': os.environ.get("MYSQL_ADDRESS").split(':')[0], 'PORT': os.environ.get("MYSQL_ADDRESS").split(':')[1], 'PASSWORD': os.environ.get("MYSQL_PASSWORD"), 'OPTIONS': {'charset': 'utf8mb4'}, } } 问题可能就出在这里了 处理建议 尝试 重试 查看 服务日志 提交工单,并在 问题描述 中附上以下信息:环境id:prod-8gt1nmide947a7d5;服务名称:django-e640;版本:django-e640-006;状态:部署失败
2022-08-01