Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
wd0517 committed Aug 14, 2023
1 parent 55b01c4 commit ed9f05c
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@

This adds compatibility for [TiDB](https://github.com/pingcap/tidb) to Django.

## Install
## Installation Guide

### Prerequisites

Before installing django-tidb, ensure you have a MySQL driver installed. You can choose either `mysqlclient`(recommended) or `pymysql`.

#### Install mysqlclient (Recommended)

Please refer to the [mysqlclient official guide](https://github.com/PyMySQL/mysqlclient#install)

#### Install pymysql

To install pymysql, use the following command:

```bash
pip install pymysql
```

Then add the following code at the beginning of your Django's `manage.py`:

```python
import pymysql

pymysql.install_as_MySQLdb()
```

### Installing django-tidb

Once you have a MySQL driver in place, proceed to install django-tidb:

```bash
pip install django-tidb
```

## Usage

Set `'ENGINE': 'django_tidb'` in your settings to this:

```
```python
DATABASES = {
'default': {
'ENGINE': 'django_tidb',
Expand All @@ -43,7 +71,7 @@ SECRET_KEY = 'django_tests_secret_key'

create your virtualenv with:

```
```bash
$ virtualenv venv
$ source venv/bin/activate
```
Expand All @@ -52,7 +80,7 @@ you can use the command ```deactivate``` to exit from the virtual environment.

run all integration tests.

```
```bash
$ DJANGO_VERSION=3.2.12 python run_testing_worker.py
```

Expand Down

0 comments on commit ed9f05c

Please sign in to comment.