home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1012661522

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/1590#issuecomment-1012661522 https://api.github.com/repos/simonw/datasette/issues/1590 1012661522 IC_kwDOBm6k_c48W_0S 9599 2022-01-14T01:16:08Z 2022-01-14T01:16:34Z OWNER

OK, I'm going to recommend a workaround for this instead. Here's asgi.py updated to strip the prefix before passing the request on to Datasette: ```python import pathlib from asgi_cors import asgi_cors from channels.routing import URLRouter from django.urls import re_path from datasette.app import Datasette

def rewrite_path(app, prefix_to_strip): async def rewrite_path_app(scope, receive, send): if ( scope["type"] == "http" and "path" in scope and scope["path"].startswith(prefix_to_strip) ): scope["path"] = scope["path"][len(prefix_to_strip) :] if "raw_path" in scope: scope["raw_path"] = scope["raw_path"][len(prefix_to_strip) :] await app(scope, receive, send)

return rewrite_path_app

datasette_ = Datasette( files=["fixtures.db"], settings={"base_url": "/datasettes/", "plugins": {}}, ) application = URLRouter( [ re_path( r"^datasettes/.*", asgi_cors(rewrite_path(datasette_.app(), "/datasettes"), allow_all=True), ), ] ) ``` This works on my laptop - please re-open the ticket if it doesn't work for you!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1099723916  
Powered by Datasette · Queries took 0.799ms · About: github-to-sqlite