简体   繁体   English

ModuleNotFoundError:在 Azure 上部署没有名为“django”的模块

[英]ModuleNotFoundError: No module named 'django' by Deploying on Azure

I'm trying to deploy a django web app to the Microsoft Azure and this is correctly deployed by the pipeline on DevOps Azure, but I get the error message (ModuleNotFoundError: No module named 'django) on portal Azure and cannot reach my app via the URL.我正在尝试将 django Web 应用程序部署到 Microsoft Azure,这已由 DevOps Azure 上的管道正确部署,但我在门户 Azure 上收到错误消息 (ModuleNotFoundError: No module named 'django) 并且无法通过以下方式访问我的应用程序网址。 The app also works properly locally Here is the whole error message: '''https://pastebin.com/mGHSS8kQ'''该应用程序在本地也能正常工作这是整个错误消息:'''https://pastebin.com/mGHSS8kQ'''

How can I solve this error?我该如何解决这个错误?

I understand you have tried the steps suggested in the SO thread Eyap shared, and few things here are already covers that.我知道您已经尝试了 Eyap 共享的 SO 线程中建议的步骤,这里很少有内容已经涵盖了这一点。 Kindly review these settings.请检查这些设置。

You can use this command instead - source /antenv3.6/bin/activate .您可以改用此命令 - source /antenv3.6/bin/activate

As a side note- The antenv will be available only after a deployment is initiated.附带说明 - 只有在启动部署后,antenv 才可用。 Kindly check the “/” path from SSH and you should see a folder with name starting from antenv.请检查 SSH 中的“/”路径,您应该会看到一个名称以 antenv 开头的文件夹。

Browse to .python_packages/lib/python3.6/site-packages/ or .python_packages/lib/site-packages/.浏览到 .python_packages/lib/python3.6/site-packages/ 或 .python_packages/lib/site-packages/。 Kindly review the file path exists.请检查文件路径是否存在。

Review the Application logs as well (/home/LogFiles folder) from Kudu- https://< yourwebpp-name >.scm.azurewebsites.net/api/logs/docker从 Kudu-https://< yourwebpp-name >.scm.azurewebsites.net/api/logs/docker 查看应用程序日志(/home/LogFiles 文件夹)

The App Service deployment engine automatically activates a virtual environment and runs应用服务部署引擎自动激活虚拟环境并运行

pip install -r requirements.txt pip install -r requirements.txt

The requirements.txt file must be in the project root for dependencies to be installed. requirements.txt 文件必须位于项目根目录中才能安装依赖项

For Django apps, App Service looks for a file named wsgi.py within your app code, and then runs Gunicorn using the following command:对于 Django 应用,应用服务会在应用代码中查找名为 wsgi.py 的文件,然后使用以下命令运行 Gunicorn:

is the name of the folder that contains wsgi.py是包含 wsgi.py 的文件夹的名称

gunicorn --bind=0.0.0.0 --timeout 600 .wsgi gunicorn --bind=0.0.0.0 --timeout 600 .wsgi

If you want more specific control over the startup command, use a custom startup command, replace with the name of folder that contains wsgi.py, and add a --chdir argument if that module is not in the project root.如果您想对启动命令进行更具体的控制,请使用自定义启动命令,替换为包含 wsgi.py 的文件夹的名称,如果该模块不在项目根目录中,则添加 --chdir 参数。

For additional details, please checkout this document有关其他详细信息,请查看此文档

Configure a Linux Python app for Azure App Service 为 Azure 应用服务配置 Linux Python 应用

Quickstart: Create a Python app in Azure App Service on Linux 快速入门:在 Linux 上的 Azure 应用服务中创建 Python 应用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Django / Heroku 部署 - ModuleNotFoundError:“没有名为 'django' 的模块” - Django / Heroku Deploying - ModuleNotFoundError: "No module named 'django'" ModuleNotFoundError:没有名为“application”的模块 [部署 Django 到 AWS] - ModuleNotFoundError: No module named 'application' [Deploying Django to AWS] ModuleNotFoundError:部署到ElasticBeanstalk时没有名为&#39;django&#39;的模块 - ModuleNotFoundError: No module named 'django' while deploying to ElasticBeanstalk ModuleNotFoundError:没有名为“azure”的模块 - ModuleNotFoundError: No module named 'azure' ModuleNotFoundError:没有名为“azure”的模块 - ModuleNotFoundError: No module named 'azure' 将 Django 部署到 Heroku 时:ModuleNotFoundError: No module named 'env' - When deploying Django to Heroku: ModuleNotFoundError: No module named 'env' 在 GCP 上部署 OpenLiteSpeed django 解决方案时出现“ModuleNotFoundError(”No module named 'MySQLdb'“,)” - “ModuleNotFoundError(”No module named 'MySQLdb'“,)” when deploying a OpenLiteSpeed django solution on GCP ModuleNotFoundError:部署到 Elastic Beanstalk 时没有名为“django”的模块 - ModuleNotFoundError: No module named 'django' when deploying to Elastic Beanstalk 将 Django 部署到 Heroku 时:ModuleNotFoundError: No module named &#39;dotenv&#39; - When deploying Django to Heroku: ModuleNotFoundError: No module named 'dotenv' ModuleNotFoundError:“没有命名的模块<mymodule> ",从 Django 部署到 Heroku 时</mymodule> - ModuleNotFoundError: "No module named <mymodule>", when deploying to Heroku from Django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM