- Устаналиваем расширение по типу requestly в браузер. В Firefox называется "Requestly V2"
- Добавлем правило:
UPD: на скрине опечатка
- Тип:
redirect - Откуда:
https://itdsocial.com/api/profile - Куда:
http://localhost:8000
- Скачиваем python если еще нету. Должно открываться что то по типу командной строки после отправки
pythonв терминал - Создаем файл с названием
main.pyжелательно в отдельной папке
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
# без корсов не пускает
app.add_middleware(
CORSMiddleware,
allow_origins=['https://itdsocial.com'],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def root():
return {'authenticated': True, 'user': {'id': '9096a85b-c319-483e-8940-6921be427ad0', 'username': 'ЮЗЕРНЕЙМ', 'displayName': 'ИМЯ', 'avatar': '💩', 'verified': False, 'roles': ['user', 'admin']}, 'banned': False}
@app.options("/")
def root_options():
returnможете вписать любой юзернейм или имя
- Скачиваем фреймворк fastapi -
pip install fastapi[standard] - Запускаем в терминале
fastapi runв папке где вы создали файл В консоли должно появится что то вроде:
FastAPI Starting production server 🚀
Searching for package file structure from directories with __init__.py files
Importing from D:\projects\test_server
module 🐍 main.py
code Importing the FastAPI app object from the module with the following code:
from main import app
app Using import string: main:app
server Server started at http://0.0.0.0:8000
server Documentation at http://0.0.0.0:8000/docs
Logs:
INFO Started server process [11860]
INFO Waiting for application startup.
INFO Application startup complete.
- Открываем
https://itdsocial.com/adminв браузере Должна открыться админ панель, но без данных