Reputation: 133
I'm facing issues with app.yaml
settings of my Python App Engine web application. Somehow except index.html rest of the static files (javascript, CSS and HTML) which I have in my application are not getting deployed to the app engine. I have tried variety of combinations of static_files
and upload
elements under script in app.yaml
. Though some of them work on local dev app server, they do not work when deployed on app engine via gcloud app deploy
. Logs produced by the gcloud do not show any errors. They show DEBUG messages like "Skipping upload of [...]" for all my static files.
Directory structure of the application (it's an AngularJS application) is as follows:
<APP ROOT>
├── app.yaml
├── my_scripts
│ ├── foo.py
│ └── ...
├── index.html
├── mainapp.py
└── web
├── assets
│ ├── css
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap-theme.min.css
│ │ ├── ....
│ │ └── ....
│ └── js
│ ├── app
│ │ ├── app.js
│ │ └── ....
│ └── lib
│ └── ...
└── partials
├── login.html
└── ...
Following is the app.yml file for my application.
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /(user|tasks)/.*
script: mainapp.app
- url: /
static_files: index.html
upload: index.html
- url: /web
static_files: web\/[^\n]*
upload: web\/[^\n]*
- url: /web
static_dir: web
Any pointers to help me fix this issue will be greatly appreciated.
Upvotes: 3
Views: 1201
Reputation: 133
The following handler configuration has worked for me:
- url: /(user|tasks)/.*
script: mainapp.app
- url: /
static_files: index.html
upload: index.html
- url: /web
static_files: web/(.*)/(.*)/(.*)/(.*)
upload: web/(.*)/(.*)/(.*)/(.*)
- url: /web
static_dir: web
Upvotes: 1
Reputation: 174864
You have the change the routing order. That is, /web
should come just before to the /
handler so that the GAE routing will look for /web
at first and then it goes for /
(note down the order top to bottom). If you define /
before /web
, it always shows the index.html
file since /
will also match /web
.
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /(user|tasks)/.*
script: mainapp.app
- url: /web
static_dir: web
- url: /
static_files: index.html
upload: index.html
And also I hope you haven't add ^web
to the skip_files
section in app.yaml
Upvotes: 1