Django Views文件在AWS Beanstalk上部署时显示选项卡错误

时间:2017-05-20 21:24:14

标签: python django amazon-web-services django-views elastic-beanstalk

我的views.py在我的本地服务器上工作正常,但在AWS Beanstalk上部署时显示此错误:

enter image description here

我的views.py文件是:

# -*- coding: utf-8 -*-
from django.views.generic.base import TemplateView
from django.http import HttpResponseRedirect, HttpResponse
from django.core.mail import send_mail

from django.shortcuts import render
from models import EmailForm


def home(request):
    return render(request, 'index.html', {})


def sendmail(request):
    if request.POST:
        form = EmailForm(request.POST)
        if form.is_valid():
            name = form.cleaned_data['name']
            email = form.cleaned_data['email']
            subject = form.cleaned_data['subject']
            message = form.cleaned_data['message']
            try:
                send_mail(subject, message + " from " + email, 'akshat.akshat6@gmail.com', ['akshatuppalweb@gmail.com'])
                return HttpResponseRedirect('/')
            except Exception, e:
                return HttpResponse('Except Block executed.' + str(e))
        else:
            return HttpResponse("Form not Valid")
    else:
        return HttpResponseRedirect('/')  

1 个答案:

答案 0 :(得分:0)

您不能在缩进中混合制表符和空格。 仔细检查python文件中的空格