tested sending email

This commit is contained in:
2017-03-26 16:55:52 +02:00
parent 429fd855de
commit 02714d3ae5
3 changed files with 82 additions and 10 deletions

View File

@@ -24,10 +24,10 @@ sqlalchemy.url = mysql://root:cni/@srvbd/bddevfac?charset=utf8
mondumas.admin_email = ctphuoc@bbox.fr
# Mailer configuration
mail.host = smtp.bbox.fr
mail.port = 587
mail.username = ctphuoc@bbox.fr
mail.password = pcao.8211
mail.host = smtp.orange.fr
mail.port = 465
mail.username = sas.dumas@orange.fr
mail.password = sasdumas
mail.ssl = yes
pyramid_mailer.prefix = mail.

View File

@@ -16,20 +16,24 @@ pyramid.includes =
pyramid_layout
pyramid_mailer
pyramid_tm
pyramid_exclog
sqlalchemy.url = mysql://root:cni/@srvbd/bddevfac?charset=utf8
mondumas.admin_email = phuoc@caotek.fr
# Mailer configuration
mail.host = localhost
mail.port = 25
mail.host = smtp.orange.fr
mail.port = 465
mail.username = sas.dumas@orange.fr
mail.password = sasdumas
mail.ssl = yes
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 9180
url_scheme = https
#url_scheme = https
###
# logging configuration
@@ -37,13 +41,13 @@ url_scheme = https
###
[loggers]
keys = root, mondumas, sqlalchemy
keys = root, mondumas, sqlalchemy, exc_logger
[handlers]
keys = console
keys = console, exc_handler
[formatters]
keys = generic
keys = generic, exc_formatter
[logger_root]
level = WARN
@@ -54,6 +58,23 @@ level = WARN
handlers =
qualname = mondumas
[logger_exc_logger]
level = ERROR
handlers = exc_handler
qualname = exc_logger
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[handler_exc_handler]
class = FileHandler
args = ('%(here)s/exception.log',)
level = ERROR
formatter = exc_formatter
[logger_sqlalchemy]
level = WARN
handlers =
@@ -70,3 +91,6 @@ formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
[formatter_exc_formatter]
format = %(asctime)s %(message)s

48
pyramidsvc.py Normal file
View File

@@ -0,0 +1,48 @@
# uncomment the next import line to get print to show up or see early
# exceptions if there are errors then run
# python -m win32traceutil
# to see the output
#import win32traceutil
import win32serviceutil
PORT_TO_BIND = 9180
CONFIG_FILE = 'production.ini'
SERVER_NAME = 'gestion.entreprise-dumas.com'
SERVICE_NAME = "Pyramid_Service"
SERVICE_DISPLAY_NAME = "Pyramid Web Service"
SERVICE_DESCRIPTION = """Permet de laner l'application Pyramid comme un servcie."""
class PyWebService(win32serviceutil.ServiceFramework):
"""Python Web Service."""
_svc_name_ = SERVICE_NAME
_svc_display_name_ = SERVICE_DISPLAY_NAME
_svc_deps_ = None # sequence of service names on which this depends
# Only exists on Windows 2000 or later, ignored on Windows NT
_svc_description_ = SERVICE_DESCRIPTION
def SvcDoRun(self):
from cherrypy import wsgiserver
from pyramid.paster import get_app
import os, sys
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
app = get_app(CONFIG_FILE)
self.server = wsgiserver.CherryPyWSGIServer(
('0.0.0.0', PORT_TO_BIND), app,
server_name=SERVER_NAME)
self.server.start()
def SvcStop(self):
self.server.stop()
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(PyWebService)