Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

16 řádky
428B

  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);