I don't think AAPnel natively supports FastAPI application, you can use a Python script as a practical solution. Here's a step-by-step guide to achieve this:
Prepare a Static Website Directory: Begin by setting up a static website folder in AApanel. Make sure to clear out any files that are automatically generated and not needed for your project.
Upload Your FastAPI Project: Transfer all the necessary files of your FastAPI project into this folder (git or uplod). Ensure that your project structure is properly organized.
Install Python Module from App Store: Navigate to the AApanel's App Store and install the Python module. This module is essential for running Python-based applications.
Set Up Your Python Project: In the Python module, add your project. This process typically involves specifying the project's directory and other settings.
Install Dependencies: Ensure all required libraries for your project are installed. Pay special attention to uvicorn, as it is the ASGI server needed to run FastAPI applications. You can install these dependencies using pip or a requirements file.
Configure the Entry Point: Direct the command to your FastAPI application's main file (e.g., main.py). This file should instantiate your FastAPI application. At the bottom of this file, include the following code to start the Uvicorn server:
if __name__ == "__main__":
import uvicorn
uvicorn.run("app:app", host="127.0.0.1", port=8000)
This code tells Python to run your FastAPI application with Uvicorn on localhost (127.0.0.1) and port 8000.
Finalize and Test: After clicking confirm, AApanel will set up your FastAPI application, which is now ready for testing. Keep in mind that this setup is primarily for testing purposes and might not be fully optimized for a production environment.