Search code examples
google-app-enginewebapp2

How do match static html files in webapp2 using a regex?


So I want to serve html files basically as they are from the root directory as well as some subdirectories, so in my app.yaml file I put:

- url: /(.*\.(html))$
  static_dir: /\1
  upload:/(.*\.(html))$

but this won't match my index.html sitting in the root directory. How do I match this? And I assume if I have subdirectories I could add them as well like:

- url: /sub_dir/(.*\.(html))$
  static_dir: sub_dir/\1
  upload: sub_dir/(.*\.(html))$

Thanks!


Solution

  • I think you may be confusing static_dir with static_files. Try:

    - url: /(.*\.(html))$
      static_files: \1
      upload: (.*\.(html))$
    

    That points to the .html file at your root.