-
Notifications
You must be signed in to change notification settings - Fork 35
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
Index on a path other than root #16
Comments
I think this is the way to do it: idx = AutoIndex(app, '/home/blackfist/reports', add_url_rules=False)
@app.route('/reports')
@app.route('/reports/<path:path>')
def autoindex(path='.'):
return idx.render_autoindex(path) I figured this out by reading the code for the AutoIndex constructor |
@stephenbez I'm seeing your solution get a bit closer to a working solution, but it still fails, I'm guessing because of flask-autoindex code changes since your comment here. Doing what you said makes a separately-routed autoindex work for an empty directory, but once there is a file or a subdirectory in there everything explodes.
I tried |
+1 for this feature - I also need to serve an auto index page on somewhere other than root. |
The following is working for me:
|
You're right @LarryKlugerDS it's the solution ! |
I'm trying to find documentation on how to configure flask-autoindex to serve up a directory on a route other than /.
AutoIndex(app, browse_root='some_path')
Works and shows me the content when I visit http://localhost:5000/. I tried to do this
@app.route('/reports')
def report_path():
AutoIndex(app, browse_root='some_path')
And I get an error. What is the proper way to do what I'm trying to do?
The text was updated successfully, but these errors were encountered: