Skip to content

Remove --debug option from datasette serve #814

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

Closed
simonw opened this issue Jun 8, 2020 · 1 comment
Closed

Remove --debug option from datasette serve #814

simonw opened this issue Jun 8, 2020 · 1 comment

Comments

@simonw
Copy link
Owner

simonw commented Jun 8, 2020

It doesn't appear to do anything useful at all:

datasette/datasette/cli.py

Lines 251 to 253 in f786033

@click.option(
"--debug", is_flag=True, help="Enable debug mode - useful for development"
)

datasette/datasette/cli.py

Lines 365 to 367 in f786033

kwargs = dict(
immutables=immutable,
cache_headers=not debug and not reload,

@simonw simonw added the refactor label Jun 8, 2020
@simonw simonw added this to the Datasette 0.44 milestone Jun 8, 2020
@simonw
Copy link
Owner Author

simonw commented Jun 8, 2020

The only impact it has at all is on this code here:

def set_response_headers(self, response, ttl):
# Set far-future cache expiry
if self.ds.cache_headers and response.status == 200:
ttl = int(ttl)
if ttl == 0:
ttl_header = "no-cache"
else:
ttl_header = "max-age={}".format(ttl)
response.headers["Cache-Control"] = ttl_header
response.headers["Referrer-Policy"] = "no-referrer"
if self.ds.cors:
response.headers["Access-Control-Allow-Origin"] = "*"
return response

That ds.cache_headers property looks like it needs rethinking too.

@simonw simonw added the small label Jun 8, 2020
@simonw simonw modified the milestones: Datasette 0.44, Datasette 1.0 Jun 8, 2020
@simonw simonw closed this as completed in 7e70643 Oct 10, 2020
simonw added a commit that referenced this issue Oct 20, 2020
@simonw simonw modified the milestones: Datasette 1.0, 0.51 Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant