django-user-sessions-ng


Namedjango-user-sessions-ng JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/yujinio/django-user-sessions-ng
SummaryDjango User Sessions NG - a Django package to manage multiple user sessions.
upload_time2024-04-28 00:08:45
maintainerNone
docs_urlNone
authoryujinio
requires_python<4.0,>=3.11
licenseMIT
keywords django sessions session-management django-user-sessions-ng
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-user-sessions-ng

`django-user-sessions-ng` is a Django package which allows users to have multiple sessions and provides session management through the Django admin interface.

This project is originally inspired by (and based on) the following projects:
1. [django-user-sessions](https://github.com/jazzband/django-user-sessions)
2. [django-qsessions](https://github.com/QueraTeam/django-qsessions)

The changes made in this repo, however, are very minimal, and the package itself is more like an adaptation for personal use.

## Features
1. Multiple sessions per user.
2. Session management through the Django admin interface.
3. Cached session data for faster access.
4. Device information for each session.
5. IP address for each session.
6. (Optional) Location information for each session.

## Installation

1. Install the package using your favorite package manager, for example pip:
    ```bash
    pip install django-user-sessions-ng
    ```

2. Add `django_user_sessions_ng` to your INSTALLED_APPS setting like this::
    ```python
    INSTALLED_APPS = [
        ...,
        "django_user_sessions_ng",
    ]
    ```

3. Add `django_user_sessions_ng.middleware.SessionMiddleware` to your MIDDLEWARE setting like this:
    ```python
    MIDDLEWARE = [
        ...,
        "django_user_sessions_ng.middleware.SessionMiddleware",
    ]
    ```

4. Set `SESSION_ENGINE` to `django_user_sessions_ng.backends.db` or `django_user_sessions_ng.backends.cached_db` depending on your preferences and whether you need cached db in your Django settings file:
    ```python
    SESSION_ENGINE = "django_user_sessions_ng.backends.db"
    ```
    or
    ```python
    SESSION_ENGINE = "django_user_sessions_ng.backends.cached_db"
    ```

5. Run `python manage.py migrate` to create the necessary models.

6. (Optional) In order to enable the location information for each session, you will need to install the package called `geoip2` and download the GeoLite2 database from [MaxMind](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data) or using the built-in `python manage.py download_geoip_db -k MAXMIND_LICENSE_KEY` command (you can get the `MAXMIND_LICENSE_KEY` by registering [at their website](https://www.maxmind.com/en/geolite2/signup) and registering a new license key) and set the `GEOIP_PATH` setting in your Django settings file to the path of the database file or directory containing multiple databases.

    For example:
    ```python
    GEOIP_PATH = "/path/to/GeoLite2"
    ```
    or
    ```python
    GEOIP_PATH = "/path/to/GeoLite2/GeoLite2-City.mmdb"
    ```


## Notes
1. Since this package replaces the functionality of the default Django session application (django.contrib.sessions), it is recommended to remove the `django.contrib.sessions` from the `INSTALLED_APPS` setting as well as `django.contrib.sessions.middleware.SessionMiddleware` from the `MIDDLEWARE` setting.
2. The package provides a management command `clearsessions` (simply imports the one from the original `django.contrib.sessions` package) which can be used to clear expired sessions. This command can be run using the following command:
    ```bash
    python manage.py django_user_sessions_ng clearsessions
    ```
3. If for some reason the MaxMind base url for download changes, and the package doesn't get updated in time, there's an optional argument `-u` or `--maxmind-geoip-download-base-url` for the `download_geoip_db` command which can be used to specify the base url for downloading the database files.

    For example:
    ```bash
    python manage.py download_geoip_db -k MAXMIND_LICENSE_KEY -u "https://download.maxmind.com/app/geoip_download"
    ```

## Credits
1. Thanks to [JazzBand](https://github.com/jazzband) for their original [django-user-sessions](https://github.com/jazzband/django-user-sessions) implementation.
2. Thanks to [QueraTeam](https://github.com/QueraTeam) for their original [django-qsessions](https://github.com/QueraTeam/django-qsessions), particularly for their tests and `cached_db` implementation.

## License
MIT

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yujinio/django-user-sessions-ng",
    "name": "django-user-sessions-ng",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "django, sessions, session-management, django-user-sessions-ng",
    "author": "yujinio",
    "author_email": "root@yujin.io",
    "download_url": "https://files.pythonhosted.org/packages/1b/4c/882f445669d71fc86287b8a8db6445f7475ec8f83238d1e6342744fea54c/django_user_sessions_ng-0.1.3.tar.gz",
    "platform": null,
    "description": "# django-user-sessions-ng\n\n`django-user-sessions-ng` is a Django package which allows users to have multiple sessions and provides session management through the Django admin interface.\n\nThis project is originally inspired by (and based on) the following projects:\n1. [django-user-sessions](https://github.com/jazzband/django-user-sessions)\n2. [django-qsessions](https://github.com/QueraTeam/django-qsessions)\n\nThe changes made in this repo, however, are very minimal, and the package itself is more like an adaptation for personal use.\n\n## Features\n1. Multiple sessions per user.\n2. Session management through the Django admin interface.\n3. Cached session data for faster access.\n4. Device information for each session.\n5. IP address for each session.\n6. (Optional) Location information for each session.\n\n## Installation\n\n1. Install the package using your favorite package manager, for example pip:\n    ```bash\n    pip install django-user-sessions-ng\n    ```\n\n2. Add `django_user_sessions_ng` to your INSTALLED_APPS setting like this::\n    ```python\n    INSTALLED_APPS = [\n        ...,\n        \"django_user_sessions_ng\",\n    ]\n    ```\n\n3. Add `django_user_sessions_ng.middleware.SessionMiddleware` to your MIDDLEWARE setting like this:\n    ```python\n    MIDDLEWARE = [\n        ...,\n        \"django_user_sessions_ng.middleware.SessionMiddleware\",\n    ]\n    ```\n\n4. Set `SESSION_ENGINE` to `django_user_sessions_ng.backends.db` or `django_user_sessions_ng.backends.cached_db` depending on your preferences and whether you need cached db in your Django settings file:\n    ```python\n    SESSION_ENGINE = \"django_user_sessions_ng.backends.db\"\n    ```\n    or\n    ```python\n    SESSION_ENGINE = \"django_user_sessions_ng.backends.cached_db\"\n    ```\n\n5. Run `python manage.py migrate` to create the necessary models.\n\n6. (Optional) In order to enable the location information for each session, you will need to install the package called `geoip2` and download the GeoLite2 database from [MaxMind](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data) or using the built-in `python manage.py download_geoip_db -k MAXMIND_LICENSE_KEY` command (you can get the `MAXMIND_LICENSE_KEY` by registering [at their website](https://www.maxmind.com/en/geolite2/signup) and registering a new license key) and set the `GEOIP_PATH` setting in your Django settings file to the path of the database file or directory containing multiple databases.\n\n    For example:\n    ```python\n    GEOIP_PATH = \"/path/to/GeoLite2\"\n    ```\n    or\n    ```python\n    GEOIP_PATH = \"/path/to/GeoLite2/GeoLite2-City.mmdb\"\n    ```\n\n\n## Notes\n1. Since this package replaces the functionality of the default Django session application (django.contrib.sessions), it is recommended to remove the `django.contrib.sessions` from the `INSTALLED_APPS` setting as well as `django.contrib.sessions.middleware.SessionMiddleware` from the `MIDDLEWARE` setting.\n2. The package provides a management command `clearsessions` (simply imports the one from the original `django.contrib.sessions` package) which can be used to clear expired sessions. This command can be run using the following command:\n    ```bash\n    python manage.py django_user_sessions_ng clearsessions\n    ```\n3. If for some reason the MaxMind base url for download changes, and the package doesn't get updated in time, there's an optional argument `-u` or `--maxmind-geoip-download-base-url` for the `download_geoip_db` command which can be used to specify the base url for downloading the database files.\n\n    For example:\n    ```bash\n    python manage.py download_geoip_db -k MAXMIND_LICENSE_KEY -u \"https://download.maxmind.com/app/geoip_download\"\n    ```\n\n## Credits\n1. Thanks to [JazzBand](https://github.com/jazzband) for their original [django-user-sessions](https://github.com/jazzband/django-user-sessions) implementation.\n2. Thanks to [QueraTeam](https://github.com/QueraTeam) for their original [django-qsessions](https://github.com/QueraTeam/django-qsessions), particularly for their tests and `cached_db` implementation.\n\n## License\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django User Sessions NG - a Django package to manage multiple user sessions.",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/yujinio/django-user-sessions-ng",
        "Repository": "https://github.com/yujinio/django-user-sessions-ng"
    },
    "split_keywords": [
        "django",
        " sessions",
        " session-management",
        " django-user-sessions-ng"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91c4a2dd144c435b0b897276d117dbffc1664d44cb154a11b16369a7d1aa8aa7",
                "md5": "4593b13ed772f28bedd9beb98bbc4f7c",
                "sha256": "4e3ce87d8c39aea3877b060eb501f0cdfabe8cb337a8f92ee877429db2d1f803"
            },
            "downloads": -1,
            "filename": "django_user_sessions_ng-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4593b13ed772f28bedd9beb98bbc4f7c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 14086,
            "upload_time": "2024-04-28T00:08:43",
            "upload_time_iso_8601": "2024-04-28T00:08:43.240149Z",
            "url": "https://files.pythonhosted.org/packages/91/c4/a2dd144c435b0b897276d117dbffc1664d44cb154a11b16369a7d1aa8aa7/django_user_sessions_ng-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b4c882f445669d71fc86287b8a8db6445f7475ec8f83238d1e6342744fea54c",
                "md5": "786cde0f8cb94f60ebacd9f21b5b57db",
                "sha256": "95a62a4831d9e80bbcb657237648c0e869e2c94980450720a442394629b274bd"
            },
            "downloads": -1,
            "filename": "django_user_sessions_ng-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "786cde0f8cb94f60ebacd9f21b5b57db",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 9417,
            "upload_time": "2024-04-28T00:08:45",
            "upload_time_iso_8601": "2024-04-28T00:08:45.009157Z",
            "url": "https://files.pythonhosted.org/packages/1b/4c/882f445669d71fc86287b8a8db6445f7475ec8f83238d1e6342744fea54c/django_user_sessions_ng-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-28 00:08:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yujinio",
    "github_project": "django-user-sessions-ng",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-user-sessions-ng"
}
        
Elapsed time: 0.25452s