Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added load_asgi_app method to CLI class #353

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion daphne/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ def _get_forwarded_port(self, args: Namespace):
if args.proxy_headers:
return "X-Forwarded-Port"

def load_asgi_app(self, asgi_app_path: str):
"""
Return the imported application.
"""
return import_by_path(asgi_app_path)

def run(self, args):
"""
Pass in raw argument list and it will decode them
Expand Down Expand Up @@ -229,7 +235,7 @@ def run(self, args):

# Import application
sys.path.insert(0, ".")
application = import_by_path(args.application)
application = self.load_asgi_app(args.application)
application = guarantee_single_callable(application)

# Set up port/host bindings
Expand Down