码迷,mamicode.com
首页 > 编程语言 > 详细

Django+jenkins+python+RESTful framework(3) 转发邮件

时间:2017-06-28 14:34:51      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:python   test   admin   frame   top   setting   lis   inf   mat   

Django的设置:

project 下的settings.py 文件中加入以下配置信息:

EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend‘
EMAIL_USE_TLS = False
EMAIL_HOST = ‘xx‘
EMAIL_PORT = 25
EMAIL_HOST_USER = ‘‘
EMAIL_HOST_PASSWORD = ‘‘
DEFAULT_FROM_EMAIL = ‘xx‘


url.py 的文件中加入
urlpatterns = [
url(r‘^sendmail/$‘, send_emails.sendEmail,name=‘sendMails‘),
]
完整代码:
"""SendMail URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r‘^$‘, views.home, name=‘home‘)
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r‘^$‘, Home.as_view(), name=‘home‘)
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r‘^blog/‘, include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from testEmail.test import Send_Email

urlpatterns = [
url(r‘^sendmail/$‘, send_emails.sendEmail,name=‘sendMails‘),
url(r‘^admin/‘, include(admin.site.urls)),
]
 

Django+jenkins+python+RESTful framework(3) 转发邮件

标签:python   test   admin   frame   top   setting   lis   inf   mat   

原文地址:http://www.cnblogs.com/QAZLIU/p/5748214.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!