Introduction to SAE Python        Jaime Chenchenzheng2@staff.sina.com.cn     PyCon China 2011          新浪 RD
A distributed system is one in which thefailure of a computer you didnt evenknow existed can render your owncomputer unusa...
内容概览示例应用SAE Python介绍沙盒实现分享
Hello, world!import saedef app(environ, start_response):   status = 200 OK   response_headers = [(Content-type,text/plain)...
http://djangoblog.sinaapp.com
http://caicaini.sinaapp.com
http://toqrcode.sinaapp.com
微博相关应用
Sina AppEngine 服务MySQLMemcacheStorageKVDBMailCronTaskQueueRank,分词,全文搜索等扩展服务http://sae.sina.com.cn/?m=devcenter&catId=33
SAE Python主页 http://appstack.sinaapp.com/文档 http://appstack.sinaapp.com/static/doc/release/testing/Git https://github.com/...
文件系统只读:$app_root, no version in path/usr/local/sae/python/lib/python2.6/saetmp/$hash/$appname/dev/urandom/etc/mime.types可写...
预装第三方模块Django-1.2.7mitsuhiko-werkzeug-0.7.1Flask-0.7.2MySQL-python-1.2.3tornado-2.1.1bottle-0.9.6sinatpy2.xUliweb-0.0.1a7S...
使用其他模块app_root 已在sys.path中参考 http://weizi888.sinaapp.com/requirements.txt TBD
Sandbox 概览cpu,mem:  apache进程线程网络文件系统
一些思考独立沙盒:   不可逆模式,python初始化后进入沙盒,无法退出受控沙盒:  沙盒每次动作都需要向主控者发出请求full-sandbox:应用代码不需修改para-sandbox:应用需要修改whitelist-sandboxblac...
A pragmatic approach
进程和线程--with-threads=no#undef HAVE_FORK#undef HAVE_SPAWNV#undef HAVE_EXECV#undef HAVE_KILL#undef HAVE_KILLPG#undef HAVE_PIP...
网络urllib, urllib2 -> socket.py -> Modules/socketmodule.cgetsockaddrargip, port 白名单访问频率控制iptable
文件操作 r_path, r_pathModules/posixmodule.c os.open, os.unlink, ...Modules/_fileio.c _fileio, io.FileIOObjects/fileobject.c P...
禁用动态扩展#undef HAVE_DYNAMIC_LOADING允许加载系统目录的c扩展?禁用模块:ctypes, _ctypes_test,_multiprocessing, dl, fcntl, grp, nis, pwd,resourc...
apache, mod_wsgiembedded modedaemon modewsgi_interpreters:   application_group -> interpreterwsgi_daemon_index:   process_...
Other Python web hosting providersGAEWebfactionGondorep.ioherokudotcloud
RoadmapGit supportInteractive debugger in protected debug modeInternal pypi, requirements.txtBackground data mining proces...
参考资料https://gist.github.com/1400023
Thanks, Q/A?
Introduction to SAE Python
Introduction to SAE Python
Introduction to SAE Python
Upcoming SlideShare
Loading in …5
×

Introduction to SAE Python

975 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
975
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to SAE Python

  1. 1. Introduction to SAE Python Jaime Chenchenzheng2@staff.sina.com.cn PyCon China 2011 新浪 RD
  2. 2. A distributed system is one in which thefailure of a computer you didnt evenknow existed can render your owncomputer unusable. -- Leslie Lamport
  3. 3. 内容概览示例应用SAE Python介绍沙盒实现分享
  4. 4. Hello, world!import saedef app(environ, start_response): status = 200 OK response_headers = [(Content-type,text/plain)] start_response(status, response_headers) return [Hello, world!]application =sae.create_wsgi_app(app)http://blackfire.sinaapp.com
  5. 5. http://djangoblog.sinaapp.com
  6. 6. http://caicaini.sinaapp.com
  7. 7. http://toqrcode.sinaapp.com
  8. 8. 微博相关应用
  9. 9. Sina AppEngine 服务MySQLMemcacheStorageKVDBMailCronTaskQueueRank,分词,全文搜索等扩展服务http://sae.sina.com.cn/?m=devcenter&catId=33
  10. 10. SAE Python主页 http://appstack.sinaapp.com/文档 http://appstack.sinaapp.com/static/doc/release/testing/Git https://github.com/SAEPython/saepythondevguideos.getcwd: app根目录,index.wsgiNo os.fork, os.system, os.exec*, os.popen*Say goodbye to subprocess
  11. 11. 文件系统只读:$app_root, no version in path/usr/local/sae/python/lib/python2.6/saetmp/$hash/$appname/dev/urandom/etc/mime.types可写:/saetmp/$hash/$appname
  12. 12. 预装第三方模块Django-1.2.7mitsuhiko-werkzeug-0.7.1Flask-0.7.2MySQL-python-1.2.3tornado-2.1.1bottle-0.9.6sinatpy2.xUliweb-0.0.1a7SQLAlchemy-0.7.3web.py-0.36
  13. 13. 使用其他模块app_root 已在sys.path中参考 http://weizi888.sinaapp.com/requirements.txt TBD
  14. 14. Sandbox 概览cpu,mem:  apache进程线程网络文件系统
  15. 15. 一些思考独立沙盒:   不可逆模式,python初始化后进入沙盒,无法退出受控沙盒:  沙盒每次动作都需要向主控者发出请求full-sandbox:应用代码不需修改para-sandbox:应用需要修改whitelist-sandboxblacklist-sandbox
  16. 16. A pragmatic approach
  17. 17. 进程和线程--with-threads=no#undef HAVE_FORK#undef HAVE_SPAWNV#undef HAVE_EXECV#undef HAVE_KILL#undef HAVE_KILLPG#undef HAVE_PIPE#undef HAVE_POPEN#undef HAVE_SYSTEM....
  18. 18. 网络urllib, urllib2 -> socket.py -> Modules/socketmodule.cgetsockaddrargip, port 白名单访问频率控制iptable
  19. 19. 文件操作 r_path, r_pathModules/posixmodule.c os.open, os.unlink, ...Modules/_fileio.c _fileio, io.FileIOObjects/fileobject.c PyFile_Type, builtin.openPython/bltinmodule.c execfilePython/traceback.c traceback.print_excPython/import.c __import__, import语句, imp模块get_file, find_moduleModules/zipimport.c其他....
  20. 20. 禁用动态扩展#undef HAVE_DYNAMIC_LOADING允许加载系统目录的c扩展?禁用模块:ctypes, _ctypes_test,_multiprocessing, dl, fcntl, grp, nis, pwd,resource, select, spwd, syslog
  21. 21. apache, mod_wsgiembedded modedaemon modewsgi_interpreters: application_group -> interpreterwsgi_daemon_index: process_group -> daemonwsgi_daemon_listPy_Newinterpreter share c-exts
  22. 22. Other Python web hosting providersGAEWebfactionGondorep.ioherokudotcloud
  23. 23. RoadmapGit supportInteractive debugger in protected debug modeInternal pypi, requirements.txtBackground data mining processAuth, billing, payment modulesVM instance for app
  24. 24. 参考资料https://gist.github.com/1400023
  25. 25. Thanks, Q/A?

×