Tuesday, October 22, 2019

Re: Daphne with absolute path to ASGI file

hi,

I checked the source code for Daphne, it uses import_by_path to import application

def import_by_path(path):
"""
Given a dotted/colon path, like project.module:ClassName.callable,
returns the object at the end of the path.
"""
module_path, object_path = path.split(":", 1)
target = importlib.import_module(module_path)
for bit in object_path.split("."):
target = getattr(target, bit)
return target

The importlib.import_module https://docs.python.org/3/library/importlib.html#importlib.import_module seems not support a path as it's args.

In linux, we can use command like 'cd path && daphne project.asgi:application' to run the application in any path, but I don't know if windows support it.

On Wed, Oct 23, 2019 at 3:57 AM BR <raceybe@gmail.com> wrote:
I've been using Daphne for months without issue, and have reorganized my project structure to make things a bit easier. However, it appears that Daphne needs to be run from the folder containing the Django project module like so:

daphne project.asgi:application

How can I specify the full path to project.asgi:application?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4fbd3a46-3939-492a-a893-86d96fbe21f5%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABexzmhVrVui6x-EyUGUUQdBtKqDpWjwPd9K_DogjgJPdwm45g%40mail.gmail.com.

No comments:

Post a Comment