def upload(request): try: res = listDir.execute(settings.UPLOAD_PATH,settings.temps[3],settings.temps[1]) f = open(settings.TEMPLATE_DIRS+"/t.html", 'w') f.write(res) f.close() return render_to_response(settings.TEMPLATE_DIRS+"/t.html", Context(csrf(request))) except IOError: return "Cannot open template upload.html"
def Dir(request, path): root = settings.Velly_Root p = os.path.join(root,path) res = listDir.execute(p, settings.temps[0], settings.temps[1]) c = Context({ 'STATIC_URL': settings.STATIC_URL }) f = open(settings.TEMPLATE_DIRS+"ind.html", "w") f.write(res) f.flush() f.close() t = loader.get_template(settings.TEMPLATE_DIRS+"ind.html") return HttpResponse(t.render(c))
import sys, find2, listDir, views print listDir.execute("/" ,"/home/velly/Django-apps/mysite/templates/temp1.html", "/home/velly/Django-apps/mysite/templates/temp2.html")