django-auth-db-router


Namedjango-auth-db-router JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/HarleyK1ng/django-auth-db-router
SummarySimple database router was originally written for personal and work purposes.
upload_time2023-02-07 09:20:25
maintainer
docs_urlNone
authorAstafeev Rustam
requires_python>=3.6
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements twine build
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django auth DB router.

Simple database router that helps to split your main database and authentication database.
This may be necessary, for example, when splitting a project into microservices.

## Quickstart

1. Add `django_auth_db_router` to your `INSTALLED_APPS` setting like this:
    ```
    INSTALLED_APPS = [
        ...
        'django_auth_db_router',
        ...
    ]
    ```

2. Add `DATABASE_ROUTERS` setting in `settings.py` file:
    ```
    DATABASE_ROUTERS = [
        'django_auth_db_router.routers.AuthRouter',
    ]
    ```
   
3. Add `auth_db` section to `DATABASES`:
   ```
   DATABASES = {
       'default': {
           'ENGINE': 'django.db.backends.sqlite3',
           'NAME': BASE_DIR / 'default.sqlite3',
       },
       'auth_db': {
           'ENGINE': 'django.db.backends.sqlite3',
           'NAME': BASE_DIR / 'auth.sqlite3',
       },
   }
    ```

4. Finally, add `AUTH_DB` setting:
   ```
   DATABASES = {
       'default': {
           'ENGINE': 'django.db.backends.sqlite3',
           'NAME': BASE_DIR / 'default.sqlite3',
       },
       'auth_db': {
           'ENGINE': 'django.db.backends.sqlite3',
           'NAME': BASE_DIR / 'auth.sqlite3',
       },
   }
   
   AUTH_DB = 'auth_db'
   ```
   
   Without this setting router will use `default` db connection.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/HarleyK1ng/django-auth-db-router",
    "name": "django-auth-db-router",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Astafeev Rustam",
    "author_email": "astafeev0308@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/4c/06c247896bebe52484e00d704b359f52e68476622b85c90768716cc34c9f/django-auth-db-router-1.2.0.tar.gz",
    "platform": null,
    "description": "# Django auth DB router.\n\nSimple database router that helps to split your main database and authentication database.\nThis may be necessary, for example, when splitting a project into microservices.\n\n## Quickstart\n\n1. Add `django_auth_db_router` to your `INSTALLED_APPS` setting like this:\n    ```\n    INSTALLED_APPS = [\n        ...\n        'django_auth_db_router',\n        ...\n    ]\n    ```\n\n2. Add `DATABASE_ROUTERS` setting in `settings.py` file:\n    ```\n    DATABASE_ROUTERS = [\n        'django_auth_db_router.routers.AuthRouter',\n    ]\n    ```\n   \n3. Add `auth_db` section to `DATABASES`:\n   ```\n   DATABASES = {\n       'default': {\n           'ENGINE': 'django.db.backends.sqlite3',\n           'NAME': BASE_DIR / 'default.sqlite3',\n       },\n       'auth_db': {\n           'ENGINE': 'django.db.backends.sqlite3',\n           'NAME': BASE_DIR / 'auth.sqlite3',\n       },\n   }\n    ```\n\n4. Finally, add `AUTH_DB` setting:\n   ```\n   DATABASES = {\n       'default': {\n           'ENGINE': 'django.db.backends.sqlite3',\n           'NAME': BASE_DIR / 'default.sqlite3',\n       },\n       'auth_db': {\n           'ENGINE': 'django.db.backends.sqlite3',\n           'NAME': BASE_DIR / 'auth.sqlite3',\n       },\n   }\n   \n   AUTH_DB = 'auth_db'\n   ```\n   \n   Without this setting router will use `default` db connection.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Simple database router was originally written for personal and work purposes.",
    "version": "1.2.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8b4af5cc5437ae37ba508edd4f4b1f000a1d4d677783b9dbddc3999b923da18",
                "md5": "ed73bfdda57777efcd4ccb0eb37862cf",
                "sha256": "86951a8c97d59db5cf947b0d4ae3fdd77d111e80ac9869b00ae03bbd8097f533"
            },
            "downloads": -1,
            "filename": "django_auth_db_router-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed73bfdda57777efcd4ccb0eb37862cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7221,
            "upload_time": "2023-02-07T09:20:23",
            "upload_time_iso_8601": "2023-02-07T09:20:23.428069Z",
            "url": "https://files.pythonhosted.org/packages/e8/b4/af5cc5437ae37ba508edd4f4b1f000a1d4d677783b9dbddc3999b923da18/django_auth_db_router-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b74c06c247896bebe52484e00d704b359f52e68476622b85c90768716cc34c9f",
                "md5": "ac6e7af1f2c06d79788d0af87936345a",
                "sha256": "a7b69373ddc4426dbd689c8374929433a8e5bc1a1a49aaa674a5d851e1ce889c"
            },
            "downloads": -1,
            "filename": "django-auth-db-router-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ac6e7af1f2c06d79788d0af87936345a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5957,
            "upload_time": "2023-02-07T09:20:25",
            "upload_time_iso_8601": "2023-02-07T09:20:25.244474Z",
            "url": "https://files.pythonhosted.org/packages/b7/4c/06c247896bebe52484e00d704b359f52e68476622b85c90768716cc34c9f/django-auth-db-router-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-07 09:20:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "HarleyK1ng",
    "github_project": "django-auth-db-router",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "twine",
            "specs": []
        },
        {
            "name": "build",
            "specs": []
        }
    ],
    "lcname": "django-auth-db-router"
}
        
Elapsed time: 0.03573s