typeerror
227
작성한 질문수 4
index.html
<html lang = 'en'>
Title
Hello World
{{ current_date }}
{{ current_date|date:"Y년 m월 d일 H시 i분 s초" }}
result.html
Title
- {{ num }}
{% for num in numbers %}
{% endif %}
views.py
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from datetime import datetime
def index(request):
now = datetime.now()
context = {
'current_date' : now
}
return render(request, 'index.html', context)
def select(request):
context = {'number':4}
return render(request, 'select.html', context)
def result(request):
context = {'numbers': [1,2,3,4,5,6]}
return render(request, 'select.html', context)
'''TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'[21/Feb/2019 21:25:19] "GET /result/ HTTP/1.1" 500 113375
'''
타입에러가 발생하는데 어디가 문제일까요?
답변 1
0
def result(request) : context = {'numbers' : [1,2,3,4,5,6] }
return render(request, 'result.html', context)
마지막에 result.html을 select.html로 쓰셔서 값이 잘못 전달된 것 같네요.
빨간 줄이 뜨네요
0
136
1
import 문장에 빨간줄이 뜹니다.
0
156
1
putty 관련 질문
0
191
1
uWSGI 세팅하기_ 최종 502 bad gateway error
0
808
1
putty 접속관련
0
305
1
[리뷰 삭제하기] 삭제시 path 에러문구나옴.
0
385
1
데이터 새성시 forms.py, models.py 관련문의
0
307
1
'폼으로 데이터 전송하기' 강의 소리가 갑자기 작아짐
0
318
1
[스태틱]index.html 의 이미지를 변경하려면 ?
0
507
1
WARNINGS: ?: (staticfiles.W004) The directory 'C:\projects\first-django\static' in the STATICFILES_DIRS setting does not exist.
0
426
1
사진 넣고 엑박...ㅜㅜ
0
335
0
간단한 웹 페이지 띄우기 강의 10분 후반쯤
0
418
0
리뷰 등록 구현하기 4:26 url 오류
0
347
1
create.html
0
359
1
502 badgateway 오류가 떠요
0
283
0
putty에서 막혔네요 ㅠㅠ
0
353
2
django) 한 폼에 여러 모델 데이터 입력하는 경우
0
327
0
파이참 안에서 가상환경 접속이 안 됩니다.
0
690
1
settings.py
0
304
1
만약 웹앱을 업데이트할경우는 어떻게 해야하나요?
0
373
1
CSS 가운데 정렬 적용 안됨
0
4833
3
NameError: name 'os' is not defined
2
1105
1
1분 26초에 post=Post.objects.create(title="this is title", content="this is content")부분이 실행이 안됩니다.
0
265
1
virtualenv가 설치가 안됩니다..
0
438
1





