I am new to django, I have pretty good idea of basics. I am able to build model(Django database) and use it in templates. But now I want to connect external database to the django templates. How do I do that? I referred to the following link - Pulling data to the template from an external database with django But I am still running into errors.
My views.py file looks like this :
def view(request):
conn = sqlite3.connect("data_new.db")
try:
cur = conn.cursor()
cur.execute("delete from data_new where date = ''; ")
cur.execute("select * from data_new;")
results = cur.fetchall()
finally:
conn.close()
return render("main.html",{"results": results})
Following error is displayed when I run it on server : -
TypeError at /
join() argument must be str or bytes, not 'dict'