These are chat archives for django/django

4th
Feb 2017
byhub
@byhub
Feb 04 2017 08:17

Hi there everyone
it is nice to be part of your group :slightly_smiling_face:
Want to be close to where freelancers/nomads feel home.. since I am starting a new service for freelancers very soon.. I dont like making too much noise; but in case anyone interested , please contact me directly..

and here is my short pitch :slightly_smiling_face:

Get freelance projects delivered to your inbox every week - sign up at http://freelance.kobikit.com #freelance #leads #webdev #design #ux #ui

cs89gr
@cs89gr
Feb 04 2017 19:40

heloo

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'),
]

views.py

from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template import RequestContext
from pygeoprocessing import routing

def calc(request):
    num = request.POST.get('num', False)
    if request.method=='POST' and 'submit' in request.POST:
        #do some image process
        #do some image process
        #do some image process
        output1 = "output1.tif"
        output2= "output2.tif"
        output3 = "output3.tif"
    return render_to_response ('blog/calc.html', {'num':num,'output1':output1},RequestContext(request))

html code

<!DOCTYPE html>
<html lang="en">
<head>

</head>

<body>
<p>EXample form</p>

<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}
<label for="file">Filename:</label>
<input type="file" name="num" id="num" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

<p>
{{ num.url }}
{{ output1.url }}
</p>
</body>
</html>

work without errors but if i press submit show my error on the browser,any idea why ?