Comments (5)
The following is working for me:
files_index = AutoIndex(app, os.path.curdir + '/app/files', add_url_rules=False)
# Custom indexing
@app.route('/files')
@app.route('/files/<path:path>')
def autoindex(path='.'):
return files_index.render_autoindex(path)
from flask-autoindex.
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
from flask-autoindex.
@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.
BuildError: ('autoindex', {'path': './somefile'}, None)
I tried path.lstrip("./")
and setting browse_root=False
on the render_autoindex
call but it nothing changed the output.
from flask-autoindex.
+1 for this feature - I also need to serve an auto index page on somewhere other than root.
from flask-autoindex.
You're right @LarryKlugerDS it's the solution !
from flask-autoindex.
Related Issues (20)
- New maintainer HOT 4
- Dark Theme for app HOT 1
- python3: ModuleNotFoundError: No module named 'flask.ext' HOT 4
- Is it possible to set action for specific file extension? HOT 2
- Running Autoindex in Docker HOT 4
- Flask-login for every paths HOT 2
- Flask-Autoindex 0.6.4 does not work with Werkzeug 1.0.0 HOT 1
- Please fix licensing ambiguation HOT 1
- How to set mimetype based on file extension HOT 1
- render_autoindex('.') not working in 0.6.6 HOT 2
- Hide files HOT 1
- file autoindex multiple downloads issue HOT 2
- How to force download instead of open in browser? HOT 9
- Redirect errors
- Autoindex send file images as attachment HOT 2
- ps
- UnicodeEncodeError when special characters in folder/file names
- Render file content
- unitest test_own_page fails with Flask 2.2
- Navigate using Keyboard ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-autoindex.