{"id":16193924,"url":"https://github.com/g4brym/django-cf","last_synced_at":"2025-03-16T10:32:34.285Z","repository":{"id":240731229,"uuid":"803035157","full_name":"G4brym/django-cf","owner":"G4brym","description":"Django database engine for Cloudflare D1 and Durable Objects","archived":false,"fork":false,"pushed_at":"2024-11-10T11:59:33.000Z","size":30,"stargazers_count":26,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T09:29:18.614Z","etag":null,"topics":["cloudflare","cloudflare-d1","d1","django","django-cloudflare","django-d1"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-cf/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/G4brym.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-19T23:28:21.000Z","updated_at":"2025-02-14T07:42:30.000Z","dependencies_parsed_at":"2024-10-10T08:17:10.953Z","dependency_job_id":"24ccc78f-2a87-4486-8e25-1acd237ed28d","html_url":"https://github.com/G4brym/django-cf","commit_stats":null,"previous_names":["g4brym/django-d1","g4brym/django-cf"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G4brym%2Fdjango-cf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G4brym%2Fdjango-cf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G4brym%2Fdjango-cf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G4brym%2Fdjango-cf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/G4brym","download_url":"https://codeload.github.com/G4brym/django-cf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814907,"owners_count":20352037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","cloudflare-d1","d1","django","django-cloudflare","django-d1"],"created_at":"2024-10-10T08:17:04.296Z","updated_at":"2025-03-16T10:32:33.398Z","avatar_url":"https://github.com/G4brym.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-cf\nDjango database engine for Cloudflare D1 and Durable Objects\n\n## Installation\n\n```bash\npip install django-cf\n```\n\n## Using with D1\n\nThe D1 engine uses the HTTP api directly from Cloudflare, meaning you only need to create a new D1 database, then\ncreate an API token with `D1 read` permission, and you are good to go!\n\nBut using an HTTP endpoint for executing queries one by one is very slow, and currently there is no way to accelerate\nit, until a websocket endpoint is available.\n\nThe HTTP api doesn't support transactions, meaning all execute queries are final and rollbacks are not available.\n\n```python\nDATABASES = {\n    'default': {\n        'ENGINE': 'django_d1',\n        'CLOUDFLARE_DATABASE_ID': '\u003cdatabase_id\u003e',\n        'CLOUDFLARE_ACCOUNT_ID': '\u003caccount_id\u003e',\n        'CLOUDFLARE_TOKEN': '\u003ctoken\u003e',\n    }\n}\n```\n\nThe Cloudflare token requires D1 Edit permissions.\n\nA simple tutorial is [available here](https://massadas.com/posts/django-meets-cloudflare-d1/) for you to read.\n\n## Using with Durable Objects\n\nThe DO engine, requires you to deploy [workers-dbms](https://github.com/G4brym/workers-dbms) on your cloudflare account.\nThis engine uses a websocket endpoint to keep the connection alive, meaning sql queries are executed way faster.\n\nworkers-dbms have an experimental transaction support, everything should be working out of the box, but you should keep\nan eye out for weird issues and report them back.\n\n\n```python\nDATABASES = {\n    'default': {\n        'ENGINE': 'django_dbms',\n        'WORKERS_DBMS_ENDPOINT': '\u003cwebsocket_endpoint\u003e',  # This should start with wss://\n        'WORKERS_DBMS_ACCESS_ID': '\u003caccess_id\u003e',  # Optional, but highly recommended!\n        'WORKERS_DBMS_ACCESS_SECRET': '\u003caccess_secret\u003e',  # Optional, but highly recommended!\n    }\n}\n```\n\n\n## Limitations\n\nWhen using D1 engine, queries are expected to be slow, and transactions are disabled.\n\nRead all Django limitations for SQLite [databases here](https://docs.djangoproject.com/en/5.0/ref/databases/#sqlite-notes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4brym%2Fdjango-cf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg4brym%2Fdjango-cf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4brym%2Fdjango-cf/lists"}