Django app can not find json file in the same directory
With the information provided, it is really hard to give you a good answer.
Howevr, I assume, that you run your view in PyCharm by actually running views.py instead of using the runserver command? In this case, the execution directory is the folder of your app and a relative path to the JSON file can be resolved.
As soon as you run a development or real server and access the view in the browser using its URL, the execution directory is the firectory of the manage.py file (the root folder of your project). If you just access the name of your JSON file, then it cannot be found, since you are searching it in the wrong folder.
What are you using the JSON file for? If it should be available in the web borwser as well (as a resource for e.g. JavaScript), then you may want to put it into the static folder of your app or project (remember to run manage.py collectstatic then). In this case, the STATIC_ROOT would be defined in settings.py and you could resolve the path from there (using os.path.join(STATIC_ROOT, "path to json file") )
My json file is in the same directory of view.py file.
However, when I open the html in browser, the IO error happens.
When I run view.py through pycharm, it works fine.
The JSon file is a database configuretion file. I want to display some data from the databse in that case I need to connect to database first.