简体   繁体   English

在Azure Web App中安装Psycopg2

[英]Installing psycopg2 in an Azure Web App

I use Heroku to host a Django web app with a postgres back-end. 我使用Heroku托管带有postgres后端的Django Web应用程序。 I'm now looking to migrate this web app to Azure, taking advantage of a great deal Azure recently offered me. 我现在正在利用Azure最近为我提供的大量功能,希望将此Web应用程序迁移到Azure。

I've made an Azure Web App, and hosted the postgres DB on a separate Azure VM. 我制作了一个Azure Web App,并将postgres数据库托管在一个单独的Azure VM上。

When I try to set up Contiguous Integration in the Azure Web app (connecting it to my github account for the purpose), I end up hitting the error: Running setup.py (path:D:\\home\\site\\wwwroot\\env\\build\\psycopg2\\setup.py) egg_info for package psycopg2 Error: pg_config executable not found. 当我尝试在Azure Web应用程序中设置连续集成(为此将其连接到我的github帐户)时,最终遇到错误: 运行setup.py(路径:D:\\ home \\ site \\ wwwroot \\ env \\ build \\ psycopg2 \\ setup.py)软件包psycopg2的egg_info错误:找不到pg_config可执行文件。

Ie, while installing from requirements.txt, it fails on trying to install psycopg2 (postgresql). 即,从Requirements.txt安装时,尝试安装psycopg2(postgresql)失败。 I'm trying to figure out what to do next from this point. 我正试图从这一点上弄清楚下一步该怎么做。 According to this , I'm supposed to run: 根据这个 ,我应该运行:

pip install git+https://github.com/nwcell/psycopg2-windows.git@win64-py27#egg=psycopg2

Now I can't run that in the console I have in my https://webapp.scm.azurewebsites.net ; 现在,我无法在https://webapp.scm.azurewebsites.net中的控制台中运行它; pip is not recognized. 点不被识别。 Should I edit my requirement.txt directly, and include that line instead of psycopg2==2.6 ? 我应该直接编辑我的psycopg2==2.6 ,并包含该行而不是psycopg2==2.6吗? In which case, since it's my master repository, I'll have to remember not to push this new requirements.txt mistakenly to Heroku. 在这种情况下,由于它是我的主存储库,因此我必须记住不要将这个新的requirements.txt错误地推送到Heroku。

There are two key points as your missing. 您有两个要点。

First, Azure Webapps normally run on the 32-bit system platform. 首先,Azure Webapp通常在32位系统平台上运行。 If you have to use the 64-bit package, you need to update the Basic or Standard mode for your apps and switch the 64-bit platform, see below in the tab Configure of Azure WebApps. 如果必须使用64位程序包,则需要更新应用程序的“基本”或“标准”模式并切换64位平台,请参见下面的“ Configure Azure WebApps”选项卡。

在此处输入图片说明

So you shoule install the psycopg2 version git+https://github.com/nwcell/psycopg2-windows.git@win32-py27#egg=psycopg2 所以你应该安装psycopg2版本git+https://github.com/nwcell/psycopg2-windows.git@win32-py27#egg=psycopg2

Second, you can run the pip command in the path D:\\Python27\\Scripts> at Kudu. 其次,您可以在Kudu的路径D:\\Python27\\Scripts>中运行pip命令。 But unfortunately, you can't directly install the python package required a compiler thru pip tool. 但不幸的是,您无法通过pip工具直接安装所需的python软件包。 Please refer to the section "Troubleshooting - Package Installation" of the document https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-configure/#troubleshooting---package-installation to know how to handle it. 请参阅文档https://azure.microsoft.com/zh-cn/documentation/articles/web-sites-python-configure/#troubleshooting---package-installation的 “疑难解答-软件包安装”部分。如何处理。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM