在带有外部库的Google Cloud App Engine上部署Django项目 [英] Deploy Django project on google Cloud App Engine with external libraries
问题描述
美好的一天!
我需要在Python Django上部署一个应用程序,并附带以下库文件:
我必须将它连接到PostgreSQL数据库。
因此,我应该使用哪种环境?标准还是灵活?
和我应该如何将这些库安装到环境中?
PS
我尝试了一切: 最后我有: > 不正确配置:加载psycopg2模块时出错:动态模块 因此,我应该使用哪种环境?标准还是灵活? 您的出发点应该是选择一个App Engine环境指南,并考虑到您的所有要求。 我必须将它连接到PostgreSQL数据库。 这个要求使得选择变得非常简单。从从App Engine进行连接: 此页面提供特定于语言的链接,介绍如何通过 如此灵活的环境。 和我应该如何将这些库安装到环境中? 这取决于您使用的环境。你试过的是标准的env方式。 在灵活的环境中,依赖关系的处理方式不同。来自相关性: 运行时查找 $ Good day! I need to deploy an app on Python Django with following libs: And I have to connect it to PostgreSQL database. So, what environment shall I use? Standard or Flexible? And how shall I install those libraries to the environment? P.S. I've tried everything: In the end I have: ImproperlyConfigured: Error loading psycopg2 module: dynamic module
does not define init function (init_psycopg)
So, what environment shall I use? Standard or Flexible? Your starting point should be the Choosing an App Engine Environment guide, taking into consideration all your requirements. And I have to connect it to PostgreSQL database. This requirement makes the choice pretty easy. From Connecting from App Engine: This page provides language-specific links to informaton about how to
set up a connection from an App Engine flexible environment
application to a Cloud SQL for PostgreSQL instance.
So flexible environment it is. And how shall I install those libraries to the environment? This dependends on the environment you use. What you tried was the standard env way. In the flexible environment dependencies are handled differently. From Dependencies: The runtime looks for a
这篇关于在带有外部库的Google Cloud App Engine上部署Django项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! app.yaml
, appengine_config.py
,我已经将libs直接安装到源代码('libs'文件夹),并将库添加到 app.yaml
甚至 google.appengine
没有定义init函数(init_psycopg)
从App Engine灵活环境
应用程序建立连接到云SQL for PostgreSQL实例。
注意:不支持从App Engine标准环境应用程序
到PostgreSQL实例的连接。
requirements.txt
文件到您的
应用程序的源目录中,并使用 pip
在启动应用程序之前安装任何
依赖项。有关
声明和管理包的更多信息,请参阅使用Python库
app.yaml
, appengine_config.py
, I has installed libs directly to source ('libs' folder), and adding libs to app.yaml
, and even google.appengine.ext.ndb.django_middleware.NdbDjangoMiddleware
Note: Connection from an App Engine standard environment application
to a PostgreSQL instance is not supported.
requirements.txt
file in your
application's source directory and uses pip
to install any
dependencies before starting your application. For more information on
declaring and managing packages, see Using Python Libraries