{"id":21846573,"url":"https://github.com/tidbcloud/branching-django-example","last_synced_at":"2026-02-06T15:06:45.718Z","repository":{"id":208215489,"uuid":"697333763","full_name":"tidbcloud/branching-django-example","owner":"tidbcloud","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-03T15:04:15.000Z","size":18,"stargazers_count":0,"open_issues_count":2,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-05T08:50:57.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidbcloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-09-27T14:14:11.000Z","updated_at":"2023-09-28T05:43:50.000Z","dependencies_parsed_at":"2025-02-05T08:42:54.860Z","dependency_job_id":"243da85a-a680-417b-8e6c-247a192e3b71","html_url":"https://github.com/tidbcloud/branching-django-example","commit_stats":null,"previous_names":["tidbcloud/branching-django-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-django-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-django-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-django-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-django-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidbcloud","download_url":"https://codeload.github.com/tidbcloud/branching-django-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285664,"owners_count":20752953,"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":[],"created_at":"2024-11-27T23:14:29.753Z","updated_at":"2026-02-06T15:06:45.691Z","avatar_url":"https://github.com/tidbcloud.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# branching-django-example\n\nFrom this repo, you can learn:\n\n- How to connect to TiDB Serverless in Django.\n- How to use branching GitHub integration.\n\n## About this repo\n\nThis repo is a Django crud example. it consists of 3 small applications:\n\n- books_cbv: Implement CRUD using CBV (Class Based Views).\n- books_fbv: Implement CRUD using FBV (Function Based Views).\n- books_fbv_user: add user interaction to books_fbv example.\n\n\u003e The repo is based on the [django_crud](https://github.com/rayed/django_crud). Thanks for the author's excellent work.\n\n## Connect to TiDB Serverless in Django\n\n1. clone the code\n\n```\ngit clone git@github.com:tidbcloud/branching-django-example.git\ncd apps\n```\n\n2. active virtual environment (Mac)\n\n```\npython3 -m venv env\nsource env/bin/activate\n```\n\nFor Windows, use env/Scripts/activate.\n\n3. Install the dependencies\n\n```\npip install -r ../requirements.txt\n```\n\n4. Fill in the .env file with your TiDB Serverless connection information. You can find the information in the TiDB Serverless console.\n\n```\nDB_DATABASE=\nDB_USER=\nDB_PASSWORD=\nDB_HOST=\nSSL_CA=\n```\n\n5. Migrate the schema\n\n\u003e make sure you have already created the database in TiDB Serverless before running the migrate command.\n\n```\n./manage.py migrate\n```\n\n6. Run the server\n\n```\n./manage.py runserver\n```\n\n## Use branching GitHub integration\n\nAssume that you have run the Django project on a TiDB Serverless. Next, you can use the [Branching GitHub integration](https://docs.pingcap.com/tidbcloud/branch-github-integration) to connect the TiDB Serverless to this repo. Then a database branch will be created for every pull request to test the changes before merging the code to the master branch.\n\nThis repo has already connected to a TiDB Serverless. Check this [pull request](https://github.com/tidbcloud/branching-django-example/pull/2) to see how we check the migration changes!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidbcloud%2Fbranching-django-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidbcloud%2Fbranching-django-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidbcloud%2Fbranching-django-example/lists"}