25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
429B

  1. from django.http import HttpResponse
  2. from django.shortcuts import render
  3. import json
  4. import os
  5. def index(request):
  6. if not os.path.isfile("/tmp/data.json"):
  7. data = {"trees": str({ "trees": []}) }
  8. else:
  9. with open("/tmp/data.json", "r") as f:
  10. loaded = json.load(f)
  11. s = json.dumps(loaded);
  12. data = {"trees": s}
  13. return render(request, "map/index.html", context=data);