Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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')
 
PREVIOUS NEXT
Tagged: #reading #json #relative #path #django
ADD COMMENT
Topic
Name
6+7 =