apprtc的src目录下,有几个文件夹,其中有app_enginee、collider、third_party和web_app。
其中collider是信令服务器相关的code。之后在分析。
third_party里面是一些库之类的东西。在其readme.txt中有一段话:
These are libraries that are required but not provided by AppEngine.
third_party中还有一个requirements.txt,readme.txt涉及到这个文件的是
pip install --target=third_party --upgrade -r third_party/requirements.txt
pip是python包管理工具,类似npm之于nodejs的关系。通过requirements.txt来对python工程所需的包进行管理。
总的说来third_party是第三方包。
web_app是web_app所需的一些文件内容。在apprtc的编译grunt build后移到out/app_enginee中。
转到src/app_enginee/app.yaml分析,文件内容
application: apprtc
version: 9
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /(.*\.html)
static_files: html/\1
upload: html/(.*\.html)
- url: /manifest.json
static_files: html/manifest.json
upload: html/manifest.json
- url: /robots.txt
static_files: html/robot.txt
upload: html/robots.txt
- url: /callstats
static_dir: third_party/callstats
- url: /images
static_dir: images
- url: /js
static_dir: js
- url: /css
static_dir: css
- url: /compute/.*
script: apprtc.app
login: admin
- url: /probe.*
script: probers.app
secure: always
- url: /.*
script: apprtc.app
secure: always
libraries:
- name: jinja2
version: latest
- name: ssl
version: latest
- name: pycrypto
version: latest
env_variables:
BYPASS_JOIN_CONFIRMATION: false
# Only change these while developing, do not commit to source!
# Use appcfg.py --env_variable=CALLSTATS_APP_ID:ID \
# --env_variable=CALLSTATS_APP_SECRET:SECRET \
# --env_variable=ICE_SERVER_API_KEY:KEY \
# in order to replace variables when deploying.
CALLSTATS_APP_ID: none
CALLSTATS_APP_SECRET: none
ICE_SERVER_API_KEY: none
依据http://blog.youkuaiyun.com/day_day_up1991/article/details/52604671介绍,可知其中的application是app的ID,和GAE平台上注册之后见的网络应用名相同。runtime和api_version表示依赖的运行环境和版本。
handlers表示不同url时,不同的处理方式。
如
url: /manifest.json
static_files: html/manifest.json
upload: html/manifest.json
表示如果url后面为/manifest.json,则对应的静态文件为html/mainfest.json。
如果是动态内容,则是脚本,比如
- url: /compute/.*
script: apprtc.app
login: admin
如果url为/compute/任意内容,则用apprtc.app来处理。
不过从实际产生作用角度,是apprtc.py在处理。