IsambardKingdomBrunel
#naukaprogramowania
#django
#python

Mam jeden problem:

1. Url działa normalnie

2. moje views:

from django.shortcuts import render
import matplotlib.pyplot as plt
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect

def graphgenerator(request):
xval = list(range(1000))
yval = [request.POST for x in xval]
plt.scatter(xval, yval, s=40)
graph = plt.figure()
graph.savefig('templatesgraphgen/graph.png')
return(HttpResponseRedirect(reverse('templates
graphgen/graph.html')))

def graph(request):
return(render(request, 'templatesgraphgen/graph.html'))

3. mój szablon:

Niniejsza strona pozwala wygenerować wykres wpisanej funkcji

Wpisz równanie z jedną niewiadomą "x"

{% csrf
token %}
{{ form.asp }}
zaakceptuj


Strona ma na celu wygenerowanie wykresu wklepanej funkcji. Wywala mi komunikat:

Reverse for 'graphgenerator' not found. 'graphgenerator' is not a valid view function or pattern name.

Co robić? Jak żyć?
1
  • Najlepsze
  • Wszystkie komentarze
c.....i
return(HttpResponseRedirect(reverse('templatesgraphgen/graph.html')))


Usuń tu reverse albo jako parametr podaj viewname z pliku urls.py

https://docs.djangoproject.com/en/1.11/ref/urlresolvers/

@IsambardKingdomBrunel:
2
Romantyczny_widelec
@IsambardKingdomBrunel: pastebin, zlituj się
0
IsambardKingdomBrunel
@Romantyczny_widelec: W sumie masz rację ale html i tak olewa wcięcia a fragment pythona jest na tyle krótki że nie dałem do pastebina
0
IsambardKingdomBrunel
@coeai: Niestety bez zmian
0
c.....i


To pewnie tu masz błąd.
Wklej na pastebin plik urls.py. Masz coś nie tak z nazwami view pewnie.

@IsambardKingdomBrunel:
0
IsambardKingdomBrunel
0