Django Auth Authentication Component Details

Introduction to Django Auth Official Documents. Django has a built-in user authentication system that handles user accounts, user groups, permissions, cookie-based sessions, and has some built-in shortcut functions. auth App has its own database system

FastAPI Error Handling

HTTPException import uvicorn from fastapi import FastAPI, HTTPException app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items/{item_id}")

FastAPI CORS

Using CORSMiddleware You can use CORSMiddleware to configure it in your FastAPI application. Import CORSMiddleware。 Create a list of allowed sources (consisting of strings)

Using speedtest-cli for speed testing

speedtest is the world's most popular network speed testing platform, and python has its corresponding library called speedtest-cli. we can use its client for network testing, or we can use the class object to test with code. We can install speedtest-cli

FastApi APIRouter usage

We usually use routes when developing apps, like Flask has blueprint, Django has urls, etc. The purpose is to manage route aggregation, and FastApi is no exception, it has APIRouter, let's learn how to use APIRouter.

Using pytest to automate testing FastAPI

FastAPI interface involving database is not difficult to write, follow the official documentation sql_databases, 5 minutes, we can generate the Restful style API about the database add, delete, change and check, the hard part is how to automate the test

Fastapi BackgroundTasks

Background tasks, which are essentially tasks that run after the response is returned. Useful for operations that need to happen after the request, but the client doesn't actually have to wait for the operation to complete before receiving the response

FastApi deployment configuration for Nginx

analytics-develop.nginx.conf limit_req_zone $binary_remote_addr zone=analytics_dev:10m rate=10r/s; map $http_forwarded $proxy_add_forwarded { # If the incoming Forwarded header is syntactically valid, append to it

FastAPI Using MongoDB for Authentication

codes #!/usr/bin/env python3 # -*- coding: utf-8 -*- import motor.motor_asyncio from fastapi import FastAPI, Request, Depends from fastapi_users import FastAPIUsers, models

Create APIs from CSV files within seconds, using fastapi

This is a Python package to create APIs from CSV files, using a lightweight & fully customizable wrapper around fastapi. Endpoints and query parameters are auto-generated based on the column names and data types in the CSV file. Its data is written to a (