diff --git a/datasette/app.py b/datasette/app.py index 37b199a4..c292542f 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -69,6 +69,9 @@ CONFIG_OPTIONS = ( ConfigOption("facet_suggest_time_limit_ms", 50, """ Time limit for calculating a suggested facet """.strip()), + ConfigOption("hash_urls", False, """ + Include DB file contents hash in URLs, for far-future caching + """.strip()), ConfigOption("allow_facet", True, """ Allow users to specify columns to facet using ?_facet= parameter """.strip()), @@ -81,9 +84,12 @@ CONFIG_OPTIONS = ( ConfigOption("allow_sql", True, """ Allow arbitrary SQL queries via ?sql= parameter """.strip()), - ConfigOption("default_cache_ttl", 365 * 24 * 60 * 60, """ + ConfigOption("default_cache_ttl", 5, """ Default HTTP cache TTL (used in Cache-Control: max-age= header) """.strip()), + ConfigOption("default_cache_ttl_hashed", 365 * 24 * 60 * 60, """ + Default HTTP cache TTL for hashed URL pages + """.strip()), ConfigOption("cache_size_kb", 0, """ SQLite cache size in KB (0 == use SQLite default) """.strip()), diff --git a/datasette/templates/database.html b/datasette/templates/database.html index f827e584..0e80c8b6 100644 --- a/datasette/templates/database.html +++ b/datasette/templates/database.html @@ -12,12 +12,12 @@ {% block content %}
home
-

{{ metadata.title or database }}

+

{{ metadata.title or database }}

{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %} {% if config.allow_sql %} -
+

Custom SQL query

@@ -27,7 +27,7 @@ {% for table in tables %} {% if show_hidden or not table.hidden %}
-

{{ table.name }}{% if table.hidden %} (hidden){% endif %}

+

{{ table.name }}{% if table.hidden %} (hidden){% endif %}

{% for column in table.columns[:9] %}{{ column }}{% if not loop.last %}, {% endif %}{% endfor %}{% if table.columns|length > 9 %}...{% endif %}

{{ "{:,}".format(table.count) }} row{% if table.count == 1 %}{% else %}s{% endif %}

@@ -35,14 +35,14 @@ {% endfor %} {% if hidden_count and not show_hidden %} -

... and {{ "{:,}".format(hidden_count) }} hidden table{% if hidden_count == 1 %}{% else %}s{% endif %}

+

... and {{ "{:,}".format(hidden_count) }} hidden table{% if hidden_count == 1 %}{% else %}s{% endif %}

{% endif %} {% if views %}

Views

{% endif %} @@ -51,13 +51,13 @@

Queries

{% endif %} {% if config.allow_download and database != ":memory:" %} -

Download SQLite DB: {{ database }}.db {{ format_bytes(size) }}

+

Download SQLite DB: {{ database }}.db {{ format_bytes(size) }}

{% endif %} {% include "_codemirror_foot.html" %} diff --git a/datasette/templates/query.html b/datasette/templates/query.html index 06651689..46aac76f 100644 --- a/datasette/templates/query.html +++ b/datasette/templates/query.html @@ -19,13 +19,13 @@ {% block body_class %}query db-{{ database|to_css_class }}{% endblock %} {% block content %} -
home / {{ database }}
+
home / {{ database }}
-

{{ metadata.title or database }}

+

{{ metadata.title or database }}

{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %} - +

Custom SQL query{% if display_rows %} returning {% if truncated %}more than {% endif %}{{ "{:,}".format(display_rows|length) }} row{% if display_rows|length == 1 %}{% else %}s{% endif %}{% endif %} {% if hide_sql %}(show){% else %}(hide){% endif %}

{% if not hide_sql %} {% if editable and config.allow_sql %} diff --git a/datasette/templates/row.html b/datasette/templates/row.html index 4ef0b758..389b16b2 100644 --- a/datasette/templates/row.html +++ b/datasette/templates/row.html @@ -16,9 +16,9 @@ {% block body_class %}row db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %} {% block content %} -
home / {{ database }} / {{ table }}
+
home / {{ database }} / {{ table }}
-

{{ table }}: {{ ', '.join(primary_key_values) }}

+

{{ table }}: {{ ', '.join(primary_key_values) }}

{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %} @@ -31,7 +31,7 @@