Configuring static files (CSS) in Java11 Appengine project

Viewed 263

I am trying to port my Java Servlet project to App Engine. I can't get my CSS file to deploy correctly.Below is my configuration and my app.yaml configuration. What am I doing wrong?

app.yaml

enter image description here

enter image description here

2 Answers

you need to change handler url of webapp. it has to be like this:

handlers:
  - url: /webapp/(.*\.(gif|png|jpg|js|css|json))$
    static_dir: webapp\1

It uses regex for those files resides in nested folders

handlers:
# All URLs beginning with /stylesheets are treated as paths to
# static files in the stylesheets/ directory.
- url: /stylesheets
  static_dir: stylesheets
  # ...

Picked from documentation

Related