0

Is there a way to create a route that is recognised only when using a local development server? I'm wanting to create a static_dir route in app.yaml but I only need it for testing.

joshhunt
  • 5,197
  • 4
  • 37
  • 60
  • What's the harm to simply add it, if it's never called in production? – Andrei Volgin Apr 12 '16 at 05:07
  • It is not that big of a problem just a little messy. For example if someone accidentally leaves something in the directory then it would be accessible to the public. – joshhunt Apr 12 '16 at 20:12

2 Answers2

1

Instead of adding/removing a static route in app.yaml, create a script/servlet that processes these requests - or ignores them if they come from the production domain.

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
  • Sorry I'm not sure what you mean, can you post an example of app.yaml? – joshhunt Apr 12 '16 at 21:08
  • Instead of adding/removing a static route in app.yaml, create a script/servlet that processes these requests - or ignores them if they come from the production domain. – Andrei Volgin Apr 12 '16 at 21:12
  • Right, yeah that's what I ended up doing. A little less clean but it works. Mind if I change your answer to the above comment? I think it makes more sense that your original answer. – joshhunt Apr 12 '16 at 21:16
0

I don't think there is a way to do that. The closest solution I can imagine is to use login: admin but I am not it works with static_dir. The documentation is here.

If it does not work, you might need to check the environment in your request handler. Please take a look at the answer here

Community
  • 1
  • 1
Edward Fung
  • 426
  • 8
  • 16