2013-03-10 60 views
2

我想知道如何在Google App Engine中安裝和使用django nonrel中的第三方庫和/或應用程序?如何在Google App Engine中使用自定義python庫和應用程序?

目前我的web應用程序使用Django的nonrel,我想安裝一些可用庫在github上:

通常遊戲庫需要通過PIP或使用easy_install命令安裝:

$ pip install django-social-auth  

如何安裝或使用Google App Engine中的庫?

示例應用程序結構:

myapp/ 
    lib/ 
     django-social-auth/  
    app.yaml 
    index.yaml 
    main.py 
    views.py 
+0

這可以是有用的解決方案:http://stackoverflow.com/questions/10648256/uploading-python-third-party-libraries-with-google-app-engine的 – 2013-03-10 16:10:43

+0

可能重複的[如何使用Google App Engine管理第三方Python庫? (virtualenv?pip?)](http://stackoverflow.com/questions/4863557/how-do-i-manage-third-party-python-libraries-with-google-app-engine-virtualenv) – Wernight 2015-09-17 15:09:39

回答

4

把你想要的庫在您的應用程序的根路徑(同一個地方作爲你的app.yaml)。您需要執行此操作(或變體),以便在部署時將庫的所有文件上載到App Engine的服務器。您機器上的實際PYTHONPATH不會直接使用。

對此的一個常見變體是將符號鏈接放到您的主應用程序路徑中的庫中。因此,這裏有一些變化:

  1. 使用PIP安裝Django的社會身份驗證,並創建符號鏈接的myapp/social_auth爲指向PIP安裝社會權威性的地方。

  2. 從github下載源代碼並將social_auth文件夾直接複製到myapp文件夾中。

  3. 將github回購同步到django-social-auth,並創建符號鏈接myapp/social_auth指向地點django-social-auth/social_auth。

相關問題