我是Python和Flask的新手。我有一个模板文件夹在我的应用程序的根目录有两个文件。用Flask-Restful返回呈现的模板在浏览器中显示HTML
{% block title %}{% endblock title %}{% block main %}{% endblock main %}
和
{% extends 'base.html' %}
{% block title %}Page Title{% endblock title %}
{% block main %}
This is a child template.
{% endblock main %}
然后我有以下功能
from flask.ext.restful import Resource,request,reqparse
from app.business.login import Login
from app.business.appointments import Appointments
from app.models.models import User, Address,Appointment
from flask import render_template
class AppointmentController(Resource):
def __init__(self):
pass
def get(self):
return render_template('index.html')
因此,当我启动服务器,并说http://0.0.0.0:5000/appointment我得到
"\n \n
\n Page Title\n \n \n \n \n \n\n\nThis is a child template.
\n\n含义模板ar e工作,但浏览器将响应视为字符串而不是html。我究竟做错了什么。