为什么我的静态文件服务于dev_appserver.py而不是GAE?

时间:2012-09-17 15:35:07

标签: google-app-engine

我的静态文件在开发服务器上运行良好,但是当我通过appcfg.py部署我的应用程序时,我的主题不会加载。当我尝试使用以下网址访问我的.css文件时,GAE返回Error: Not Found

http://sprucepress.appspot.com/static/default/css/bootstrap-responsive.css

我已经下载了我的源代码副本并验证了这些文件实际上是在GAE上。我还验证了一切正在我的本地dev_appserver.py上运行。

您可以看到current deployed version on GitHub

我的目录结构......

  • 的app.yaml
  • static.py
  • 主题
    • 默认
      • 管理员
        • edit.html
        • 的index.html
        • published.html
      • 资产
        • css
        • ico
        • img
        • js
      • base.html文件
      • listings.html
      • post.html
    • 简单
      • 默认
      • 管理员
        • edit.html
        • 的index.html
        • published.html
      • 资产
        • css
        • ico
        • img
        • js
      • base.html文件
      • listings.html
      • post.html

我的app.yaml。

application: sprucepress
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:

- url: /admin/.*
  script: admin.app
  login: admin

- url: /static/([^/]+)/(.*)
  static_files: themes/\1/assets/\2
  upload: themes/[^/]+/static/.*

- url: .*
  script: static.app

builtins:
- remote_api: on

libraries:
- name: webapp2
  version: "2.5.1"

- name: jinja2
  version: latest

HTML无效的示例..

<link href="/static/default/css/bootstrap.css" rel="stylesheet" />

直播网站位于http://sprucepress.appspot.com

更新1 - 我尝试重新部署,但这并没有解决问题。

更新2 - 这是我的appcfg.py输出。

john@ogradylan-lap01:~$ appcfg.py update google_projects/sprucepress
09:27 AM Host: appengine.google.com
09:27 AM Application: sprucepress; version: 1
09:27 AM 
Starting update of app: sprucepress, version: 1
09:27 AM Getting current resource limits.
Email: <ny email>
Password for <ny email>: 
09:27 AM Scanning files on local disk.
09:27 AM Cloning 117 application files.
09:27 AM Cloned 100 files.
09:27 AM Compilation starting.
09:27 AM Compilation completed.
09:27 AM Starting deployment.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 1 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 2 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 4 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 8 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Deployment successful.
09:27 AM Checking if updated app version is serving.
09:27 AM Will check again in 1 seconds.
09:27 AM Checking if updated app version is serving.
09:27 AM Will check again in 2 seconds.
09:28 AM Checking if updated app version is serving.
09:28 AM Will check again in 4 seconds.
09:28 AM Checking if updated app version is serving.
09:28 AM Will check again in 8 seconds.
09:28 AM Checking if updated app version is serving.
09:28 AM Completed update of app: sprucepress, version: 1
09:28 AM Uploading index definitions.

更新3 我已经下载了应用程序以验证文件实际上是在服务器上。一切似乎都已正确上传。

appcfg.py download_app -A sprucepress sp3
09:37 AM Host: appengine.google.com
09:37 AM Fetching file list...
Email: <my email>
Password for <my email>: 
09:37 AM Fetching files...
09:37 AM [1/117] themes/default/assets/ico/apple-touch-icon-114-precomposed.png
09:37 AM [2/117] themes/default/assets/js/bootstrap-carousel.js
09:37 AM [3/117] themes/default/assets/css/bootstrap.css
09:37 AM [4/117] lib/wtforms/ext/django/templatetags/wtforms.py
09:37 AM [5/117] themes/default/assets/img/glyphicons-halflings.png
09:37 AM [6/117] lib/wtforms/fields/__init__.py
09:37 AM [7/117] themes/default/assets/img/examples/bootstrap-example-fluid.jpg
09:37 AM [8/117] themes/default/assets/css/bootstrap-responsive.css
09:37 AM [9/117] lib/wtforms/ext/i18n/__init__.py
09:37 AM [10/117] themes/default/assets/js/bootstrap-modal.js
09:37 AM [11/117] lib/wtforms/compat.py
09:37 AM [12/117] lib/wtforms/widgets/__init__.py
09:37 AM [13/117] static.py
09:37 AM [14/117] themes/default/assets/js/bootstrap-tooltip.js
09:37 AM [15/117] themes/default/assets/img/grid-baseline-20px.png
09:37 AM [16/117] themes/default/listing.html
09:37 AM [17/117] lib/wtforms/fields/simple.py
09:37 AM [18/117] themes/default/assets/img/bs-docs-masthead-pattern.png
09:37 AM [19/117] themes/default/assets/js/bootstrap-alert.js
09:37 AM [20/117] lib/wtforms/ext/i18n/messages/pl/LC_MESSAGES/wtforms.mo
09:37 AM [21/117] themes/default/assets/img/bs-docs-bootstrap-features.png
09:37 AM [22/117] themes/default/assets/ico/apple-touch-icon-72-precomposed.png
09:37 AM [23/117] app.yaml
09:37 AM [24/117] themes/default/assets/js/jquery.js
09:37 AM [25/117] lib/wtforms/ext/__init__.py
09:37 AM [26/117] lib/wtforms/ext/sqlalchemy/__init__.py
09:37 AM [27/117] lib/wtforms/ext/django/templatetags/__init__.py
09:37 AM [28/117] themes/default/assets/js/bootstrap.min.js
09:37 AM [29/117] lib/aetycoon/app.yaml
09:37 AM [30/117] themes/default/assets/img/examples/bootstrap-example-hero.jpg
09:37 AM [31/117] themes/default/assets/js/bootstrap-button.js
09:38 AM [32/117] favicon.ico
09:38 AM [33/117] lib/wtforms/ext/django/i18n.py
09:38 AM [34/117] lib/wtforms/ext/i18n/form.py
09:38 AM [35/117] themes/default/assets/img/example-sites/jshint.png
09:38 AM [36/117] themes/default/assets/img/responsive-illustrations.png
09:38 AM [37/117] themes/default/assets/ico/favicon.ico
09:38 AM [38/117] themes/default/admin/index.html
09:38 AM [39/117] themes/default/assets/js/google-code-prettify/prettify.js
09:38 AM [40/117] lib/wtforms/validators.py
09:38 AM [41/117] themes/default/assets/css/docs.css
09:38 AM [42/117] themes/default/admin/edit.html
09:38 AM [43/117] lib/wtforms/ext/csrf/form.py
09:38 AM [44/117] lib/wtforms/ext/i18n/messages/pl/LC_MESSAGES/wtforms.po
09:38 AM [45/117] lib/wtforms/ext/django/orm.py
09:38 AM [46/117] admin.py
09:38 AM [47/117] themes/default/assets/ico/apple-touch-icon-144-precomposed.png
09:38 AM [48/117] lib/wtforms/ext/i18n/messages/en/LC_MESSAGES/wtforms.po
09:38 AM [49/117] themes/default/assets/img/examples/bootstrap-example-starter.jpg
09:38 AM [50/117] handlers.py
09:38 AM [51/117] lib/wtforms/ext/i18n/messages/es/LC_MESSAGES/wtforms.po
09:38 AM [52/117] themes/default/assets/js/bootstrap-scrollspy.js
09:38 AM [53/117] themes/default/assets/js/bootstrap-tab.js
09:38 AM [54/117] lib/aetycoon/README
09:38 AM [55/117] lib/wtforms/ext/i18n/messages/fa/LC_MESSAGES/wtforms.mo
09:38 AM [56/117] lib/wtforms/ext/i18n/messages/fa/LC_MESSAGES/wtforms.po
09:38 AM [57/117] themes/default/assets/test.jpg
09:38 AM [58/117] themes/default/assets/js/README.md
09:38 AM [59/117] lib/wtforms/ext/i18n/messages/wtforms.pot
09:38 AM [60/117] lib/wtforms/ext/sqlalchemy/fields.py
09:38 AM [61/117] themes/default/assets/js/google-code-prettify/prettify.css
09:38 AM [62/117] themes/default/admin/published.html
09:38 AM [63/117] lib/wtforms/ext/csrf/fields.py
09:38 AM [64/117] models.py
09:38 AM [65/117] lib/wtforms/ext/i18n/messages/en/LC_MESSAGES/wtforms.mo
09:38 AM [66/117] lib/wtforms/ext/i18n/messages/es/LC_MESSAGES/wtforms.mo
09:38 AM [67/117] themes/default/assets/img/bootstrap-mdo-sfmoma-03.jpg
09:38 AM [68/117] themes/default/assets/ico/apple-touch-icon-57-precomposed.png
09:38 AM [69/117] themes/default/assets/js/bootstrap-popover.js
09:38 AM [70/117] lib/wtforms/ext/dateutil/fields.py
09:38 AM [71/117] lib/wtforms/fields/core.py
09:38 AM [72/117] config.py
09:38 AM [73/117] lib/wtforms/ext/appengine/fields.py
09:38 AM [74/117] themes/default/assets/img/bs-docs-twitter-github.png
09:38 AM [75/117] themes/default/assets/js/bootstrap.js
09:38 AM [76/117] lib/wtforms/ext/i18n/messages/README.txt
09:38 AM [77/117] lib/wtforms/ext/i18n/messages/zh/LC_MESSAGES/wtforms.po
09:38 AM [78/117] themes/default/assets/img/less-logo-large.png
09:38 AM [79/117] themes/default/assets/img/example-sites/soundready.png
09:39 AM [80/117] themes/default/assets/img/example-sites/kippt.png
09:39 AM [81/117] lib/wtforms/widgets/core.py
09:39 AM [82/117] themes/default/base.html
09:39 AM [83/117] lib/wtforms/ext/i18n/messages/it/LC_MESSAGES/wtforms.mo
09:39 AM [84/117] utils.py
09:39 AM [85/117] themes/default/assets/js/bootstrap-affix.js
09:39 AM [86/117] lib/wtforms/ext/csrf/__init__.py
09:39 AM [87/117] index.yaml
09:39 AM [88/117] lib/wtforms/ext/django/fields.py
09:39 AM [89/117] themes/default/assets/js/bootstrap-typeahead.js
09:39 AM [90/117] lib/wtforms/ext/csrf/session.py
09:39 AM [91/117] generators.py
09:39 AM [92/117] lib/wtforms/ext/sqlalchemy/validators.py
09:39 AM [93/117] README.md
09:39 AM [94/117] lib/wtforms/ext/i18n/messages/zh/LC_MESSAGES/wtforms.mo
09:39 AM [95/117] themes/default/assets/js/bootstrap-transition.js
09:39 AM [96/117] themes/default/assets/img/bootstrap-mdo-sfmoma-02.jpg
09:39 AM [97/117] listing.html
09:39 AM [98/117] lib/wtforms/ext/i18n/utils.py
09:39 AM [99/117] themes/default/assets/js/bootstrap-dropdown.js
09:39 AM [100/117] themes/default/assets/js/bootstrap-collapse.js
09:39 AM [101/117] themes/default/assets/js/application.js
09:39 AM [102/117] lib/wtforms/ext/appengine/db.py
09:39 AM [103/117] lib/wtforms/ext/i18n/messages/it/LC_MESSAGES/wtforms.po
09:39 AM [104/117] themes/default/assets/img/example-sites/fleetio.png
09:39 AM [105/117] lib/wtforms/ext/sqlalchemy/orm.py
09:39 AM [106/117] fix_path.py
09:39 AM [107/117] lib/wtforms/form.py
09:39 AM [108/117] themes/default/post.html
09:39 AM [109/117] lib/wtforms/ext/appengine/__init__.py
09:39 AM [110/117] lib/wtforms/__init__.py
09:39 AM [111/117] themes/default/assets/img/bs-docs-responsive-illustrations.png
09:39 AM [112/117] lib/wtforms/ext/django/__init__.py
09:39 AM [113/117] lib/wtforms/ext/dateutil/__init__.py
09:39 AM [114/117] themes/default/assets/img/bootstrap-mdo-sfmoma-01.jpg
09:39 AM [115/117] themes/default/assets/img/glyphicons-halflings-white.png
09:39 AM [116/117] main.py
09:39 AM [117/117] lib/aetycoon/__init__.py

1 个答案:

答案 0 :(得分:4)

upload值应为themes/[^/]+/assets/.*。你没有主题内的静态文件夹。