drydrop icon indicating copy to clipboard operation
drydrop copied to clipboard

Question: how to make index.html the default in all directories?

Open zzamboni opened this issue 14 years ago • 7 comments

Hi,

Is there a forum of some other place to ask questions like this?

First of all, drydrop is very very useful! I'm using it to migrate my static web sites to GAE and get rid of a rented dedicated server.

Second, I know this is more of a GAE question, but I thought you may have encountered it - how to make index.html the default file for all directories? I tried the following:

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

But this resulted in a syntax error. I would like if possible to avoid having to add handlers for all my directories.

Thanks a lot.

zzamboni avatar Sep 30 '09 14:09 zzamboni

I don't have answer for this, because I don't remember it. I've used google's code which existed in their app engine SDK at some point.

I did quick scan of this document: http://code.google.com/appengine/docs/python/config/appconfig.html

According to that document regexps should work and I don't see any mistake in your site.yaml. Maybe they updated their code and this document... or there is some bug on my side :-/

darwin avatar Sep 30 '09 16:09 darwin

And yes, this is the best place for asking questions. I don't have time to open and maintain separate support forum for drydrop.

darwin avatar Sep 30 '09 16:09 darwin

Thanks for all the support!

zzamboni avatar Sep 30 '09 22:09 zzamboni

I'm toying a bit with the code, trying to make it an option for drydrop to automatically search for index.html in directories instead of trying to fetch the directory itself. My current algorithm is this: if query returns with 404 and the requested filename does not have an extension (to avoid trying this on every single file not found), then append "/index.html" and try again.

This seems to work fine for most cases, but I think it would be best to just test if the requested file is a directory, and then append /index.html to it from the start. However, not being very familiar with GAE, I don't know if this is possible.

Thanks for any ideas! I will push a patch to my branch when I'm happier with the code, in case you want to take a look at it.

zzamboni avatar Oct 03 '09 18:10 zzamboni

if you fork I'll look at it for sure.

your approach is more like a hack, so I cannot promise I'll include it into official drydrop. in drydrop I'd like to see working those regexps from appconfig.html docs.

darwin avatar Oct 03 '09 19:10 darwin

I actually think using regexes to identify directories is more of a hack, because there is no way to reliably do it (unless you assume a slash is ALWAYS included at the end of a directory request, but this is not the case). If there is a way to detect if a requested resource is a directory, and only then append /index.html to it, then it would be the same mechanism that a regular web server uses.

I haven't had a chance to look more at the code, but I'll do in the next few days and send you a patch.

zzamboni avatar Oct 07 '09 09:10 zzamboni

You can use github api to see what is a directory, e.g, https://api.github.com/repos/phonegap/phonegap-start/contents/www vs https://api.github.com/repos/phonegap/phonegap-start/contents/www/index.html

yoav-zibin avatar Sep 01 '12 21:09 yoav-zibin