pdm install
These are equivalent (given the main.py code)
UVICORN_ROOT_PATH=/api/ pdm run uvicorn main:app
FASTAPI_ROOT_PATH=/api/ pdm run uvicorn main:app
--- | |
kind: pipeline | |
type: docker | |
name: linux-amd64 | |
trigger: | |
branch: | |
- myapp | |
event: |
This FastAPI application serves as an HTTP proxy, forwarding client requests to an upstream API server and relaying the server's response back to the client. It supports arbitrary paths and HTTP methods, providing a versatile proxy solution for various API interactions.
# adapted from https://github.com/fastapi/fastapi/issues/1788 | |
from fastapi import FastAPI | |
from starlette.requests import Request | |
from starlette.responses import StreamingResponse | |
from starlette.background import BackgroundTask | |
import uvicorn | |
import httpx | |
API_KEY = os.getenv('API_KEY') |
You are Manus, an AI agent created by the Manus team. | |
You excel at the following tasks: | |
1. Information gathering, fact-checking, and documentation | |
2. Data processing, analysis, and visualization | |
3. Writing multi-chapter articles and in-depth research reports | |
4. Creating websites, applications, and tools | |
5. Using programming to solve various problems beyond development | |
6. Various tasks that can be accomplished using computers and the internet |
This is Python's http.server that has been bundled to an .exe using PyInstaller. You can use it as a local web server for testing. | |
Run the local server | |
1. Copy the server.exe into the folder you want to serve and then double click it to start the local server. | |
2. A window will pop up letting you know the server is running on port 8000. | |
3. Open http://localhost:8000/ in your web browser. | |
4. When you are done, simply close the server.exe window to stop the local server. | |
If you have another service running on port 8000, you can run on a different port like so: | |
1. Open Command Prompt |
Quick Start
https://docs.k3s.io/quick-start
curl -sfL https://get.k3s.io | sh -
FROM ubuntu:latest | |
MAINTAINER Ahmed Maawy | |
# Run updates | |
RUN apt-get update --fix-missing && apt-get install -y | |
# Install Curl | |
RUN apt-get install curl -y | |
# Install supervisor |
Motor is an async Python driver for MongoDB.
You should use Motor when you're trying to interact with a MongoDB database in an asynchronous context. When you're making something that needs to be asynchronous (like a web server, or most commonly from what I've seen here, Discord bots), you also want all the database calls to be done asynchronously. But pymongo is synchronous, i.e it is blocking, and will block the execution of your asynchronous program for the time that it is talking to the database.
Thankfully for us, switching from pymongo to Motor isn't too hard, and won't need you to change much code. This process can be roughly summarized as:
Installing can be done with pip - pip install motor