本文介绍了在带有外部库的Google Cloud App Engine上部署Django项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!

我需要在Python Django上部署一个应用程序,并附带以下库文件:


  • certifi == 2017.4.17

  • chardet == 3.0.4

  • Django == 1.11.2

  • httplib2 == 0.10.3

  • idna == 2.5

  • oauth2 == 1.9.0.post1

  • psycopg2 == 2.7.1

  • pytz == 2017.2

  • 请求== 2.18.1

  • urllib3 == 1.21.1



我必须将它连接到PostgreSQL数据库。

因此,我应该使用哪种环境?标准还是灵活?



我应该如何将这些库安装到环境中?

PS



我尝试了一切: app.yaml appengine_config.py ,我已经将libs直接安装到源代码('libs'文件夹),并将库添加到 app.yaml 甚至 google.appengine

最后我有: >

不正确配置:加载psycopg2模块时出错:动态模块
没有定义init函数(init_psycopg)


解决方案

您的出发点应该是指南,并考虑到您的所有要求。

这个要求使得选择变得非常简单。从:

如此灵活的环境。

这取决于您使用的环境。你试过的是标准的env方式。

在灵活的环境中,依赖关系的处理方式不同。来自:


Good day!

I need to deploy an app on Python Django with following libs:

  • certifi==2017.4.17
  • chardet==3.0.4
  • Django==1.11.2
  • httplib2==0.10.3
  • idna==2.5
  • oauth2==1.9.0.post1
  • psycopg2==2.7.1
  • pytz==2017.2
  • requests==2.18.1
  • urllib3==1.21.1

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: 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

In the end I have:

解决方案

Your starting point should be the Choosing an App Engine Environment guide, taking into consideration all your requirements.

This requirement makes the choice pretty easy. From Connecting from App Engine:

So flexible environment it is.

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:

这篇关于在带有外部库的Google Cloud App Engine上部署Django项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 10:21