You can migrate web projects in Python by using the custom runtime and HTTP triggers of Function Compute. You can access a function by using a browser or HTTP client tools such as cURL. You can modify the Python sample code as needed for custom development.


  1. Run the following command to initialize a project:
    s init fc-custom-python37-http -d fc-custom-python37-http
    Note -d specifies the name of the folder in which the sample project resides. You can customize the folder name as required.
  2. Run the following command to go to the project directory:
    cd fc-custom-python37-http
    Note The sample project in this topic allows you to concurrently process requests by using a single instance.
  3. Optional: Modify the sample code as needed for custom development.
  4. Run the following command to deploy the project:
    s deploy -y
    Sample command output:
    [2022-01-27 03:43:13] [INFO] [S-CLI] - Start the pre-action
    [2022-01-27 03:43:13] [INFO] [S-CLI] - Action: s build --use-docker
    [2022-01-27 03:43:14] [INFO] [FC-BUILD] - Build artifact start...
    [2022-01-27 03:43:15] [INFO] [FC-BUILD] - Use docker for building.
    [2022-01-27 03:43:15] [INFO] [FC-BUILD] - Build function using image: aliyunfc/runtime-custom:build-1.10.1
    [2022-01-27 03:43:15] [INFO] [FC-CORE] - Skip pulling image aliyunfc/runtime-custom:build-1.10.1...
    [2022-01-27 03:43:18] [INFO] [FC-BUILD] - Build artifact successfully.
    Tips for next step
    * Invoke Event Function: s local invoke
    * Invoke Http Function: s local start
    * Deploy Resources: s deploy
    End of method: build
    [2022-01-27 03:43:18] [INFO] [S-CLI] - End the pre-action
    ⠋ Checking Function pyHttpFunc exists
     Checking Service, Function, Triggers (3.14s)
     Creating Service, Function, Triggers (17.52s)
     End of request
     End of request
     Creating custom domain (7.63s)
    Tips for next step
    * Display information of the deployed resource: s info
    * Display metrics: s metrics
    * Display logs: s logs
    * Invoke remote function: s invoke
    * Remove Service: s remove service
    * Remove Function: s remove function
    * Remove Trigger: s remove trigger
    * Remove CustomDomain: s remove domain
      region:   cn-hangzhou
        name: hello-world-service
        name:       pyHttpFunc
        runtime:    custom
        handler:    index.handler
        memorySize: 1536
        timeout:    30
        system_url:    https://188077086902****
            domain: http://pyhttpfunc.hello-world-service.188077086902****
          type: http
          name: http_t


After the project is deployed, you can view the temporary domain name that is generated by Function Compute in the output. The temporary domain name can be used to access the newly deployed application. For example, run the following command to access the application:

curl http://pyhttpfunc.hello-world-service.188077086902****
Note You can use the temporary domain name only for demonstration and development purposes. It is valid for a limited period of time. In a production environment, you must use a domain name for which an Internet Content Provider (ICP) filing is obtained from Alibaba Cloud. For more information, see Configure a custom domain name.