flask-pg-session


Nameflask-pg-session JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/giuppep/flask-pg-session
SummaryFlask extension that implements server-side sessions in PostgreSQL
upload_time2023-05-22 08:22:06
maintainer
docs_urlNone
authorGiuseppe Papallo
requires_python>3.8.1
licenseMIT
keywords flask server-side session session
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FlaskPgSession

`FlaskPgSession` is a [`Flask`](https://flask.palletsprojects.com/) extensions that
implements server-side session support and stores the data in a PostgreSQL table.

It is inspired by [`Flask-Session`](https://flasksession.readthedocs.io/en/latest/)
but it's focused only on integration with PostgreSQL and therefore has fewer
dependencies.

It is intended for people that are already using Flask with PostgreSQL and do not want
to add another dependency to their app just for storing sessions (e.g. Redis).

## Installation

You can install `FlaskPgSession` using `pip`

```bash
pip install flask-pg-session
```

## Usage

Usage is pretty straightforward: just import `FlaskPgSession` and intialise it with
your `Flask` app:

```python
from flask import Flask
from flask_pg_session import FlaskPgSession

app = Flask("my-app")

# You can either pass the app as an argument to the constructor
FlaskPgSession(app)

# or initialise it separately
session = FlaskPgSession()
session.init_app(app)
```

## Configuration

The extension can be configured via the `Flask` config file. The following options are
available:

- `SQLALCHEMY_DATABASE_URI`: The URI of the PostgreSQL database to use.
- `SESSION_PG_TABLE`: The name of the table to store sessions in. Defaults to `flask_sessions`.
- `SESSION_PG_SCHEMA`: The name of the schema to store sessions in. Defaults to `public`.
- `SESSION_KEY_PREFIX`: The prefix to use for session IDs. Absent by default.
- `SESSION_USE_SIGNER`: Whether to sign session IDs. Defaults to False.
- `SESSION_PERMANENT`: Whether to set the `permanent` flag on sessions. Defaults to True.
- `SESSION_AUTODELETE_EXPIRED`: Whether to automatically delete expired
sessions. Defaults to True.
- `SESSION_PG_MAX_DB_CONN`: The maximum number of database connections to use. Defaults to 10.

## Contributions

Contributions are welcome! If you encounter any issues, have suggestions, or would like
to contribute to `FlaskPgSession`, please feel free to submit a pull request or
open an issue.


## License

`FlaskPgSession` is open source and released under the MIT License.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/giuppep/flask-pg-session",
    "name": "flask-pg-session",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">3.8.1",
    "maintainer_email": "",
    "keywords": "flask,server-side session,session",
    "author": "Giuseppe Papallo",
    "author_email": "giuseppe@papallo.it",
    "download_url": "https://files.pythonhosted.org/packages/45/f7/f53fc18800a20c228d0a9c1cd70592e09643d2ed537dea3ba81d847e0f20/flask_pg_session-0.1.0.tar.gz",
    "platform": null,
    "description": "# FlaskPgSession\n\n`FlaskPgSession` is a [`Flask`](https://flask.palletsprojects.com/) extensions that\nimplements server-side session support and stores the data in a PostgreSQL table.\n\nIt is inspired by [`Flask-Session`](https://flasksession.readthedocs.io/en/latest/)\nbut it's focused only on integration with PostgreSQL and therefore has fewer\ndependencies.\n\nIt is intended for people that are already using Flask with PostgreSQL and do not want\nto add another dependency to their app just for storing sessions (e.g. Redis).\n\n## Installation\n\nYou can install `FlaskPgSession` using `pip`\n\n```bash\npip install flask-pg-session\n```\n\n## Usage\n\nUsage is pretty straightforward: just import `FlaskPgSession` and intialise it with\nyour `Flask` app:\n\n```python\nfrom flask import Flask\nfrom flask_pg_session import FlaskPgSession\n\napp = Flask(\"my-app\")\n\n# You can either pass the app as an argument to the constructor\nFlaskPgSession(app)\n\n# or initialise it separately\nsession = FlaskPgSession()\nsession.init_app(app)\n```\n\n## Configuration\n\nThe extension can be configured via the `Flask` config file. The following options are\navailable:\n\n- `SQLALCHEMY_DATABASE_URI`: The URI of the PostgreSQL database to use.\n- `SESSION_PG_TABLE`: The name of the table to store sessions in. Defaults to `flask_sessions`.\n- `SESSION_PG_SCHEMA`: The name of the schema to store sessions in. Defaults to `public`.\n- `SESSION_KEY_PREFIX`: The prefix to use for session IDs. Absent by default.\n- `SESSION_USE_SIGNER`: Whether to sign session IDs. Defaults to False.\n- `SESSION_PERMANENT`: Whether to set the `permanent` flag on sessions. Defaults to True.\n- `SESSION_AUTODELETE_EXPIRED`: Whether to automatically delete expired\nsessions. Defaults to True.\n- `SESSION_PG_MAX_DB_CONN`: The maximum number of database connections to use. Defaults to 10.\n\n## Contributions\n\nContributions are welcome! If you encounter any issues, have suggestions, or would like\nto contribute to `FlaskPgSession`, please feel free to submit a pull request or\nopen an issue.\n\n\n## License\n\n`FlaskPgSession` is open source and released under the MIT License.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Flask extension that implements server-side sessions in PostgreSQL",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/giuppep/flask-pg-session/issues",
        "Documentation": "https://github.com/giuppep/flask-pg-session#readme",
        "Homepage": "https://github.com/giuppep/flask-pg-session",
        "Repository": "https://github.com/giuppep/flask-pg-session"
    },
    "split_keywords": [
        "flask",
        "server-side session",
        "session"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58922e30790d8ce7889df496bc2153753cd5a467746a1ef2fb9cc031769bd76c",
                "md5": "6f7328f43824af85b4488b1a4e17ef3c",
                "sha256": "51f499fb315daa23c23b8761d8b598542f4d0f2210591ba9740686d638e33e48"
            },
            "downloads": -1,
            "filename": "flask_pg_session-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6f7328f43824af85b4488b1a4e17ef3c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">3.8.1",
            "size": 8649,
            "upload_time": "2023-05-22T08:22:05",
            "upload_time_iso_8601": "2023-05-22T08:22:05.073739Z",
            "url": "https://files.pythonhosted.org/packages/58/92/2e30790d8ce7889df496bc2153753cd5a467746a1ef2fb9cc031769bd76c/flask_pg_session-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45f7f53fc18800a20c228d0a9c1cd70592e09643d2ed537dea3ba81d847e0f20",
                "md5": "42c32f1571945b95315c765af51f2cb9",
                "sha256": "44aeb8ce933945facb06d31408ceea372b47c7b77123525bfb8c1e5e5a890725"
            },
            "downloads": -1,
            "filename": "flask_pg_session-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "42c32f1571945b95315c765af51f2cb9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">3.8.1",
            "size": 7154,
            "upload_time": "2023-05-22T08:22:06",
            "upload_time_iso_8601": "2023-05-22T08:22:06.670240Z",
            "url": "https://files.pythonhosted.org/packages/45/f7/f53fc18800a20c228d0a9c1cd70592e09643d2ed537dea3ba81d847e0f20/flask_pg_session-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-22 08:22:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "giuppep",
    "github_project": "flask-pg-session",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flask-pg-session"
}
        
Elapsed time: 0.07260s