URLS.py文件

# 导入三个模块文件
from django.contrib import admin
from django.urls import path
from app01 import views

# 设置URL路径
urlpatterns = [
    path('admin/', admin.site.urls),
    path('index/', views.index, name='index'),
]

FORMS.py文件

from django import forms
class T1Form(forms.Form):
    email = forms.EmailField(
        min_length=6,
        required=True,
        label='邮箱'
    )
    host = forms.CharField(
        min_length=6,
        required=True,
        label='主机'
    )
    port = forms.CharField(
        min_length=6,
        required=True,
        label='端口'
    )
    mobile = forms.IntegerField(
        required=True,
        label='手机'
    )

T1.html文件

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Apollo</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>
    <script>

    </script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <form action="" method="post" class="form-horizontal" novalidate>
                <!-- POST请求必须写 -->
                {% csrf_token %}
                <!-- 循环Form组件实例化对象 -->
                {% for field in form_obj %}
                    <div class="form-group">
                        <!-- 渲染label标签 -->
                        <label class="col-sm-2 control-label">{{ field.label_tag }}</label>
                        <div class="col-sm-10">
                            <!-- INPUT框 -->
                            {{ field }}
                            <!-- 渲染错误 -->
                            <span style="color: red">{{ field.errors.0 }}</span>
                        </div>
                    </div>
                {% endfor %}
                <!-- 提交按钮 -->
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>