i want to do some image processing using Django and now work and on the image handling(donwloading/display) using Django. first on my task i dont want to store that images on my server. but i have some problems. that my code : urls.py from django.conf.urls import url from . import views
urlpatterns = [ #url(r'^$',views.index, name='index'), url(r'^$',views.calc, name='calc'), ] file.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form method="POST" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <input type="button" value="Submit"> </form> {{ flow_direction_uri.url }} </body> </html> forms.py from django import forms class ImageUploadForm(forms.Form): """Image upload form.""" image = forms.ImageField() views.py from django.shortcuts import render from django.shortcuts import render_to_response from django.template import RequestContext from pygeoprocessing import routing from django import forms from blog.forms import ImageUploadForm def calc(request): form = ImageUploadForm() if request.method == "POST" and form.is_valid(): image_file = request.FILES['image'] form.save() '''do something image process''' '''and finaly i take that output in standalone python script out of django''' outpu1 = "outpu1.tif" outpu2 = "outpu2.tif" outpu3 = "outpu3.tif" outpu4 = "outpu4.tif" return render_to_response ('blog/calc.html', {'form':form,'output1':output1}, RequestContext(request)) and i take that error : UnboundLocalError at / local variable 'output1' referenced before assignment but i thing so its not that error why if i change to response request to {return render_to_response ('blog/calc.html', {'form':form}, RequestContext(request)) ` dont show me that error i can see in the browser two buttons where i can choose image from my files and submit button but i thing so that do nothing. maybe to use html forms and no Django forms ? -- https://mail.python.org/mailman/listinfo/python-list