flask-json-db
A flask extension to log a variable value inside view in a JSON file
Installation
- For stable version
pip install flask-json-db
- For developement
cd flask-json-db
python -m venv .venv
source .venv/bin/activate
Example
from flask import Flask
from flask_json_db import JSONDB
app = Flask(__name__)
app.config["JSONFILE"] = "custom.json" #optional
json_db = JSONDB(app)
@app.route('/')
def hello_world():
json_db.write({"landing_view_var":"landing_view_var_value"})
return 'Hello World'
@app.route("/home")
def home():
json_db.write({"home_var":["jshajdhjs"]})
return 'ghj'
@app.route("/new_home")
def new_home():
db.write({"new_home_var": "new_home_var_value"})
return "hjk"
if __name__ == '__main__':
app.run()
open the custom.json and get to know about these variable values
General Info
I don’t know how can it be helpful but it is helpful for me :)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Metadata
Release files for flask-json-db 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flask-json-db-0.0.1.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_json_db-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 kB
Release files / flask-json-db-0.0.1.tar.gz
| Download URL | flask-json-db-0.0.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b99ebc2d5de5989137451953bd786fd56851a9a586e3ac1ae480abb51a9289b
|
|
BLAKE2b-256 checksum How to use checksums |
7d4b2f5bfde2fc677cde4fb16d0f9962fdcac0d66f0ad27cfc92636bde6d0e32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / flask_json_db-0.0.1-py3-none-any.whl
| Download URL | flask_json_db-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f81e437396fcdfa8872a023c571cc12e1273198d684ba81202435fb82b04c5c7
|
|
BLAKE2b-256 checksum How to use checksums |
71fcff91da929a542a5112f69bc0b4f2c66084ac1069bb5709b932114db4a604
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|