尝试发送邮件时appengine配置不正确的数据库错误(使用django_bootstrap) [英] appengine improperly configured database error when trying to send mail (using django_bootstrap)
问题描述
我使用 django_bootstrap .py 有类似的错误,但我找不到解决办法。我正在使用django助手(请不要建议非rel)
我想要做的是,在一个静态的html js网站内附加一个发送邮件的功能,通过联系表格。表单将获取数据,jQuery将验证并向URL/ sendmail /发送POST AJAX请求,其中views.py包含以下代码:
def sendmail(请求):
logging.info(here1)
msg = request.POST ['comment']; sub = request.POST ['subject']
name = request.POST ['name']; frm = request.POST ['email']
sender = name ++ frm
logging.info(sender)
a = mail.send_mail(sender = sender,
to =to@example.com,
subject = sub,
body = msg)
logging.info(请求)
logging.info(a)
return http.HttpResponse(1)
当我删除该行时, p>
a = mail.send_mail(sender = sender,
to =to@example.com,
subject = sub,
body = msg)
然而,以下错误:
< class'django.core.exceptions.ImproperlyConfigured'> ;:您尚未设置DATABASE_ENGINE设置尚未。
我查看我的settings.py文件并尝试进行一些更改:
1加两行在django-nonrel settings.py中完成
pre $ D $ DABABASES ['native'] = DATABASES ['default']
DATABASES ['default'] = {'ENGINE':'dbindexer','TARGET':'native'}
服务器发生500错误,页面未打开。
2我尝试过放入
DATABASE_ENGINE ='dummy'
这适用于本地,但不适用于服务器(appspot)。
<3>我尝试过放入
DATABASE_ENGINE ='appengine'
这也给了500错误。
请让我知道如何解决它。如果你在应用程序中没有使用数据库,你可以设置 DATABASES = {} / code>在settings.py文件中。这将解决问题您尚未设置DATABASE_ENGINE设置。
I am using django_bootstrap.py there are similar errors but i could not find solution to it. I am using django helper(please do not suggest non-rel)
What i was trying to do was, inside a static html js website attaching a feature of sending mail, through a contact form. The form would take the data, and jQuery would validate and make a POST AJAX request to the url "/sendmail/" the views.py i have the following code:
def sendmail(request):
logging.info("here1")
msg = request.POST['comment']; sub = request.POST['subject']
name = request.POST['name']; frm = request.POST['email']
sender = name + " " + frm
logging.info(sender)
a = mail.send_mail(sender=sender,
to="to@example.com",
subject=sub,
body=msg)
logging.info(request)
logging.info(a)
return http.HttpResponse("1")
I get absolutely no error when i remove the line:
a = mail.send_mail(sender=sender,
to="to@example.com",
subject=sub,
body=msg)
However with that line being there, i get the following error:
<class 'django.core.exceptions.ImproperlyConfigured'>: You haven't set the DATABASE_ENGINE setting yet.
I look at my settings.py file and try making some changes: 1 adding two lines as done in django-nonrel settings.py
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
This gave a 500 error on server and the page did not open.
2 I tried putting
DATABASE_ENGINE = 'dummy'
This works locally but doesnot work on server(appspot).
3 I tried putting
DATABASE_ENGINE = 'appengine'
This too gives a 500 error.
Please let me know how to solve it.
If you are not using a database in your application, you can set DATABASES = {}
in your settings.py file. This will fix the problem "You haven't set the DATABASE_ENGINE setting yet".
这篇关于尝试发送邮件时appengine配置不正确的数据库错误(使用django_bootstrap)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!