Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zzamboni opened this issue Sep 30, 2009 · 7 comments
Open

Comments

@zzamboni
Copy link

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.

@darwin
Copy link
Member

darwin commented Sep 30, 2009

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
Copy link
Member

darwin commented Sep 30, 2009

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

@zzamboni
Copy link
Author

Thanks for all the support!

@zzamboni
Copy link
Author

zzamboni commented Oct 3, 2009

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.

@darwin
Copy link
Member

darwin commented Oct 3, 2009

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.

@zzamboni
Copy link
Author

zzamboni commented Oct 7, 2009

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.

@yoav-zibin
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants