Advertisement
harsh7i

PyDjangoPath.py

Jun 22nd, 2022 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import os
  2.  
  3. def results(request):
  4.     module_dir = os.path.dirname(__file__)  
  5.     file_path = os.path.join(module_dir, 'data.txt')   #full path to text.
  6.     data_file = open(file_path , 'r')      
  7.     data = data_file.read()
  8.     context = {'rooms': data}
  9.     return render(request, 'javascript/results.html',context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement