How to deploy a complete Azure Functions project without missing files in Python?

175 Views Asked by At

I'm encountering an issue with my Azure Functions deployment. Only core function files are being uploaded, omitting essential project files. I need to resolve this without utilizing pipelines.

I'm facing an issue with my Azure Functions deployment. Only the core function files are uploading, leaving out essential project files. I'm trying to resolve this without relying on pipelines. Any suggestions or insights from developers who have faced similar challenges would be greatly appreciated. Thanks!

1

There are 1 best solutions below

0
Vivek Vaibhav Shandilya On

I have deployed a function using VS code. For reference check this MS Document

This is my project directory:

enter image description here

When deploying through VS code, make sure you remove the essential files names from the .funcignore file.

enter image description here

I have a folder name func in which I have test.py file if is being imported in my HTTP trigger.

__init__.py:

   import logging
   import func.test as test
   import azure.functions as func
   
   
   def main(req: func.HttpRequest) -> func.HttpResponse:
       logging.info('Python HTTP trigger function processed a request.')
   
       name = req.params.get('name')
       if not name:
           try:
               req_body = req.get_json()
           except ValueError:
               pass
           else:
               name = req_body.get('name')
   
       if name:
           t=test.fun()
           return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.\n This is from test.py file: {t}")
       else:
           return func.HttpResponse(
                "This HTTP triggered function executed successfully. Pass a name ",status_code=200
           )

test.py:

def fun():
    return("Hello")

Deployed to the function:

enter image description here

enter image description here

Output:

enter image description here

In web browser:

enter image description here