Answers for "reading json without using relative path in django"

0

reading json without using relative path in django

"""
So let's say you want to import a JSON file that you have in your
local (Django Project) you can use this rather than using a relative
path which can give you some issues.
"""

import importlib

json_text = importlib.resources.read_text('app.folder_name', 'file_name.json')
Posted by: Guest on July-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language