I'm setting app on Heroku. I do in instruction like so:
In error 1, I code in Notepad and run it in command:
import requests
from django.shortcuts import render
from django.http import HttpResponse
from .models import Greeting
# Create your views here.
def index(request):
r = requests.get('http://httpbin.org/status/418')
print(r.text)
return HttpResponse('<pre>' + r.text + '</pre>')
def db(request):
greeting = Greeting()
greeting.save()
greetings = Greeting.objects.all()
return render(request, 'db.html', {'greetings': greetings})
But it dont run like instruction
My command appeard that so i dont know what can I should do.
I was try like Stack help
I am not sure if your question is still on, but I'm digging into heroku right now, too and I have a solution for you. The fcntl module is a standard library available... on Linux only! You won't find it under Windows environment, which you are apparently using (hint: Notepad mentioned ;)
But no worries, just follow the official tutorial's previous lesson and invoke the local heroku server like:
This should start your local heroku server no problem, under: http://localhost:5000
Hope that helps!
P.S. Don't run views.py on its own like that. The tutorial strictly says to do it under the virtual environment, then it works, like planned.