home / docs / sections

Menu

sections: custom_templates:serving-files-from-a-directory

This data as json

id page ref title content breadcrumbs references
custom_templates:serving-files-from-a-directory custom_templates serving-files-from-a-directory Serving files from a directory Datasette can serve static files from a directory for you, using the --static option. Consider the following directory structure: metadata.json static-files/styles.css static-files/app.js You can start Datasette using --static assets:static-files/ to serve those files from the /assets/ mount point: datasette --config datasette.yaml --static assets:static-files/ --memory The following URLs will now serve the content from those CSS and JS files: http://localhost:8001/assets/styles.css http://localhost:8001/assets/app.js You can reference those files from datasette.yaml like this, see custom CSS and JavaScript for more details: [[[cog from metadata_doc import config_example config_example(cog, """ extra_css_urls: - /assets/styles.css extra_js_urls: - /assets/app.js """) ]]] [[[end]]] ["Custom pages and templates"] []
Powered by Datasette · Queries took 2.735ms