首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
Python Cookbook
›
Using Google App Engine
推荐下载
›
Latest Google App Engine SDK
其他兼容技术
›
AppScale
V2EX
›
Google App Engine
使用 VirtualEnv 简化依赖管理
1
yegle
·
2014-12-31 08:21:17 +08:00
· 4955 次点击
这是一个创建于 3743 天前的主题,其中的信息可能已经有所发展或是发生改变。
GAE的Python部署方式不支持从requirements.txt安装依赖,和其他PaaS平台如heroku比实在太过于上个世纪,让人吐槽不能。传统的在GAE上管理包的方式是创建virtualenv目录然后创建软链接到项目根目录,或者自己手写hack代码修改sys.path。
最近SDK里新加了一个vendor helper,稍微可以方便一点。大致步骤写在gist的comment里。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
import os
from google.appengine.ext import vendor
"""
1. Create a virtualenv directory at the root of your project, name it "venv"
2. Install packages needed in your project
3. Freeze it and save the package list into requirements.txt file, add it to
version control
4. Exclude "venv" directory from version control
5. Save the content of this file as "appengine_config.py", and put it at the
root of your project
"""
VENV = os.path.join(os.path.dirname(__file__), "venv")
vendor.add(VENV)
view raw
appengine_config.py
hosted with ❤ by
GitHub
virtualenv
GAE
根目录
4 条回复
•
2015-01-01 13:58:17 +08:00
1
kappa
2014-12-31 08:39:01 +08:00 via iPhone
听说自从龟多跑路以后,Python在G家就半残了?
2
yegle
OP
2014-12-31 16:06:38 +08:00 via Android
@
kappa
至少在SRE领域内Python还是主流。不过Go的势头太猛好处太多,目测再有一年左右能抢到Python的地盘并且抢走一部分C++的地盘。
3
geeti
2015-01-01 01:23:48 +08:00
多年不见北邮人的老id啊
4
yegle
OP
2015-01-01 13:58:17 +08:00 via Android
@
geeti
老到没人认识我了吧都。
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
5507 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms ·
UTC 01:51
·
PVG 09:51
·
LAX 18:51
·
JFK 21:51
Developed with
CodeLauncher
♥ Do have faith in what you're doing.