Google App Engine的新项目结构 [英] New project structure for Google App Engine

查看:78
本文介绍了Google App Engine的新项目结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到这个问题已经有



该应用的顶级目录可容纳每个应用的配置(不适用于特定的模块): dispatch.yaml cron.yaml index.yaml queue.yaml 。请注意,cron作业和任务队列定义属于这里(但是没有任何东西能够阻止你根据请求的路径将各种cron作业发送到各个模块)。

d也可以在应用程序的顶层目录中放置任何我想以DRY方式在多个模块中共享的文件/目录。这些文件/目录将由模块通过在各个模块内将它们进行符号链接来共享,以便模块在部署时获得它自己的副本。几乎所有可以作为单独文件或目录存在的 可以以这种方式共享: 脚本,CSS,宏,数据存储模型定义,python模块 - 无论你需要什么

  • 第三方库,例如如何从Python模块中访问自营商店库Google App Engine ?

  • 模块的 .yaml 配置的一部分!例如:我需要吗?在多个YAML文件中复制`skip_files`?



  • 最后,推荐的特定模块的文件/目录结构可能会更进一步取决于模块语言/沙箱,使用的框架,开发人员的风格/偏好等。我认为不可能提供一种适用于所有情况的有效/可接受的通用建议。


    I see that there is already an answer to this question but I feel its outdated. Many things have changes since then. There are now modules, cloud_endpoints and webapp2. What should be the good directory structure for my project which allows me to add/modify features easily.

    For example I should be able to manage:

    1. Modules.
    2. Cron jobs.
    3. Task queues.
    4. Cloud endpoints.

    解决方案

    I'd first take a look at modules, at least for these reasons:

    • modules really are in many respects (almost) equivalents to entire (single-module) apps in older docs/references, so once a module's position in the app's hierarchy is clarified various posts referencing an app-context can usually be extrapolated to just a module-only context.
    • nowadays an app can use different languages/sandboxes for different modules (see Run both Java and PHP on google app engine project) or even for different versions of the same module (see Google App Engine upgrading part by part)

    Personally I'd stick with the recommended multi-module app structure - each module having its own directory, one level below the app's directory:

    The app's top dir would hold the per-app configs (which aren't applicable to a particular module): dispatch.yaml, cron.yaml, index.yaml, and queue.yaml. Note that the cron jobs and task queues definitions belong here (but nothing stops you from routing/dispatching various cron jobs to various modules based on the requested paths).

    I'd also place in the app's top level dir any files/directories I'd like to share across multiple modules in the DRY way. These files/dirs would be shared by a module by symlinking them inside the respective modules so that the module gets its own copy at deployment. Almost anything that can exist as a separate file or directory can be shared this way:

    Finally the recommended files/dir structure of a particular module may further depend on the module language/sandbox, the framework(s) used, the developer's style/preferences, etc. I don't think it's possible to provide a one-size-fits-all recommendation which would be effective/acceptable in all cases.

    这篇关于Google App Engine的新项目结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆