mirror of
				https://github.com/django/daphne.git
				synced 2025-11-04 01:27:33 +03:00 
			
		
		
		
	Added load_asgi_app method to CLI class (#353)
Allows simple override point for folks compiling their application, with e.g. PyInstaller. Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
This commit is contained in:
		
							parent
							
								
									80d619d7b6
								
							
						
					
					
						commit
						b8b4d2a5f7
					
				| 
						 | 
				
			
			@ -201,6 +201,12 @@ class CommandLineInterface:
 | 
			
		|||
        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
 | 
			
		||||
| 
						 | 
				
			
			@ -230,7 +236,7 @@ class CommandLineInterface:
 | 
			
		|||
 | 
			
		||||
        # 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user