diff --git a/emmett/__version__.py b/emmett/__version__.py index 29768434..fc78dc7b 100644 --- a/emmett/__version__.py +++ b/emmett/__version__.py @@ -1 +1 @@ -__version__ = "2.5.11" +__version__ = "2.5.12" diff --git a/emmett/_reloader.py b/emmett/_reloader.py index f3edd2f0..58e1a167 100644 --- a/emmett/_reloader.py +++ b/emmett/_reloader.py @@ -17,7 +17,6 @@ import os import signal import subprocess -import ssl import sys import time @@ -151,8 +150,8 @@ def run(self, process): def run_with_reloader( interface, app_target, - host, - port, + host='127.0.0.1', + port=8000, loop='auto', log_level=None, log_access=False, @@ -174,8 +173,10 @@ def run_with_reloader( process = multiprocessing.Process( target=_server_run, - args=(interface, app_target, host, port), + args=(interface, app_target), kwargs={ + "host": host, + "port": port, "loop": loop, "log_level": log_level, "log_access": log_access, diff --git a/emmett/cli.py b/emmett/cli.py index dd1f2eba..9cd977c2 100644 --- a/emmett/cli.py +++ b/emmett/cli.py @@ -287,12 +287,11 @@ def develop_command( runner( interface, app_target, - host, - port, + host=host, + port=port, loop=loop, log_level='debug', log_access=True, - threads=1, threading_mode="workers", ssl_certfile=ssl_certfile, ssl_keyfile=ssl_keyfile, @@ -315,6 +314,9 @@ def develop_command( @click.option( '--interface', type=click.Choice(['rsgi', 'asgi']), default='rsgi', help='Application interface.') +@click.option( + '--http', type=click.Choice(['auto', '1', '2']), default='auto', + help='HTTP version.') @click.option( '--ws/--no-ws', is_flag=True, default=True, help='Enable websockets support.') @@ -342,7 +344,7 @@ def develop_command( '--ssl-keyfile', type=str, default=None, help='SSL key file') @pass_script_info def serve_command( - info, host, port, workers, threads, threading_mode, interface, ws, loop, opt, + info, host, port, workers, threads, threading_mode, interface, http, ws, loop, opt, log_level, access_log, backlog, backpressure, ssl_certfile, ssl_keyfile ): app_target = info._get_import_name() @@ -360,6 +362,7 @@ def serve_command( threading_mode=threading_mode, backlog=backlog, backpressure=backpressure, + http=http, enable_websockets=ws, ssl_certfile=ssl_certfile, ssl_keyfile=ssl_keyfile, diff --git a/emmett/server.py b/emmett/server.py index b59f4435..92bd1f49 100644 --- a/emmett/server.py +++ b/emmett/server.py @@ -28,6 +28,7 @@ def run( threading_mode='workers', backlog=1024, backpressure=None, + http='auto', enable_websockets=True, ssl_certfile: Optional[str] = None, ssl_keyfile: Optional[str] = None @@ -43,6 +44,7 @@ def run( threading_mode=threading_mode, loop=loop, loop_opt=loop_opt, + http=http, websockets=enable_websockets, backlog=backlog, backpressure=backpressure, diff --git a/emmett/tools/auth/ext.py b/emmett/tools/auth/ext.py index 70d89bec..4477af19 100644 --- a/emmett/tools/auth/ext.py +++ b/emmett/tools/auth/ext.py @@ -355,14 +355,14 @@ def _registration_email(self, user, data): data['email'] = user.email return self.app.ext.MailExtension.send_mail( recipients=user.email, - subject=self.config.messages['registration_email_subject'], + subject=str(self.config.messages['registration_email_subject']), body=str(self.config.messages['registration_email_text'] % data)) def _reset_password_email(self, user, data): data['email'] = user.email return self.app.ext.MailExtension.send_mail( recipients=user.email, - subject=self.config.messages['reset_password_email_subject'], + subject=str(self.config.messages['reset_password_email_subject']), body=str(self.config.messages['reset_password_email_text'] % data)) diff --git a/pyproject.toml b/pyproject.toml index d9c7dd27..99cd9379 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,9 +3,9 @@ name = "emmett" [tool.poetry] name = "emmett" -version = "2.5.11" +version = "2.5.12" description = "The web framework for inventors" -authors = ["Giovanni Barillari "] +authors = ["Giovanni Barillari "] license = "BSD-3-Clause" readme = "README.md" @@ -47,7 +47,7 @@ emmett = "emmett.cli:main" [tool.poetry.dependencies] python = "^3.8" click = ">=6.0" -granian = "~1.4.1" +granian = "~1.5.0" emmett-crypto = "^0.6" pendulum = "~3.0.0" pyDAL = "17.3"