您如何配置应用引擎以使用文件结构中的 node_modules 文件夹部署您的应用程序?
How do you configure the app engine to deploy your app with the node_modules folder in the file stucture?
我将 grunt 与 google 应用程序引擎一起使用,但每次尝试部署时,我都必须将 node_modules 从目录中取出才能正常工作。
这是我的文件结构-
project/
lib/
node_modules/
app/
static/
templates/
__init__.py
views.py
models.py
.gitignore
README.md
app.yaml
appengine_config.py
Gruntfile.js
package.json
所以我查看了有关此主题的其他问题 here 但它是针对 java 的,我正在使用 python 那么您如何配置应用引擎来部署您的应用文件结构中的 node_modules 文件夹?我忽略了所有 grunt 文件,没有将它们提交到我的回购协议中,所以我不知道这里有任何帮助将不胜感激。
您可以在应用的配置文件中使用 the skip_files element:
The skip_files element specifies which files in the application
directory are not to be uploaded to App Engine. The value is either a
regular expression, or a list of regular expressions. Any filename
that matches any of the regular expression is omitted from the list of
files to upload when the application is uploaded.
注意覆盖该文档部分中的默认值。
application: project
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /*.svg
static_files: app/static/images/images_dest/*.svg
upload: app/static/images/images_dest/*.svg
mime_type: image/svg+xml
- url: /static
static_dir: app/static
- url: .*
script: app.app
skip_files:
- ^(node_modules)
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
libraries:
- name: jinja2
version: "2.6"
- name: markupsafe
version: "0.15"
我将 grunt 与 google 应用程序引擎一起使用,但每次尝试部署时,我都必须将 node_modules 从目录中取出才能正常工作。
这是我的文件结构-
project/
lib/
node_modules/
app/
static/
templates/
__init__.py
views.py
models.py
.gitignore
README.md
app.yaml
appengine_config.py
Gruntfile.js
package.json
所以我查看了有关此主题的其他问题 here 但它是针对 java 的,我正在使用 python 那么您如何配置应用引擎来部署您的应用文件结构中的 node_modules 文件夹?我忽略了所有 grunt 文件,没有将它们提交到我的回购协议中,所以我不知道这里有任何帮助将不胜感激。
您可以在应用的配置文件中使用 the skip_files element:
The skip_files element specifies which files in the application directory are not to be uploaded to App Engine. The value is either a regular expression, or a list of regular expressions. Any filename that matches any of the regular expression is omitted from the list of files to upload when the application is uploaded.
注意覆盖该文档部分中的默认值。
application: project
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /*.svg
static_files: app/static/images/images_dest/*.svg
upload: app/static/images/images_dest/*.svg
mime_type: image/svg+xml
- url: /static
static_dir: app/static
- url: .*
script: app.app
skip_files:
- ^(node_modules)
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
libraries:
- name: jinja2
version: "2.6"
- name: markupsafe
version: "0.15"