第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
  • Python的類型提示type hints

    Pydantic是一個(gè)基于Python類型提示來定義數(shù)據(jù)驗(yàn)證,序列化和

    文檔(使用SON模式)庫

    Starlette是一種輕量級(jí)的ASGl框架/工具包,是構(gòu)建高性能

    Asyncio服務(wù)的理想選擇

    查看全部
  • 語言特點(diǎn):

    1、性能優(yōu)越;

    2、開發(fā)效率高;

    3、減少認(rèn)為bug50%以上;

    查看全部
  • sqlalchemy


    626723b00001959509600540.jpg
    查看全部
  • 版本問題,與教師版本最好保持一致

    查看全部
  • 需要注意框架的版本與包的版本是否一致,有可能版本不一致導(dǎo)致BUG產(chǎn)生

    查看全部
  • 注意python第三方包版本不一致出現(xiàn)的兼容性問題

    查看全部
  • pycharm 中使用anoconda python 編輯器,但是python console直接顯示error exit 1:

    ?import _ssl DLL load fail error


    解決方法:

    From?anaconda3\Library\bin?copy?below files and?paste?them in?anaconda3/DLLs:

    - ? libcrypto-1_1-x64.dll
    - ? libssl-1_1-x64.dll

    https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error

    查看全部
  • pycharm 直接使用new project 創(chuàng)建project,使用virtualenv方式 指定anoconda的python解釋器作為project的python解釋器。

    在使用pip install的時(shí)候,出現(xiàn)SSL錯(cuò)誤:

    WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/aiofiles/

    Could not fetch URL https://pypi.org/simple/aiofiles/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/aiofiles/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

    ERROR: Could not find a version that satisfies the requirement aiofiles==0.6.0 (from versions: none)

    ERROR: No matching distribution found for aiofiles==0.6.0。


    原因是在windows powershell中使用anoconda的pip命令,需要在環(huán)境變量中添加如下三項(xiàng):

    D:\Anaconda3
    D:\Anaconda3\Scripts
    D:\Anaconda3\Library\bin

    (https://stackoverflow.com/questions/45954528/pip-is-configured-with-locations-that-require-tls-ssl-however-the-ssl-module-in)


    powershell中添加環(huán)境變量方法:

    ?$env:Path += ";D:\Anaconda3"?

    https://stackoverflow.com/questions/714877/setting-windows-powershell-environment-variables)

    查看環(huán)境變量方法:dir env:


    添加后一切正常。

    查看全部
  • http://img1.sycdn.imooc.com//6195ebc70001426c13670770.jpg

    代碼沒問題,但是運(yùn)行報(bào)錯(cuò)了

    框架有包的版本兼容問題

    查看全部
  • 思路清晰,講解細(xì)致,通俗易懂,項(xiàng)目貫穿知識(shí)點(diǎn),十分?。?! 希望能在出一版大型項(xiàng)目的教程
    查看全部
    0 采集 收起 來源:課程總結(jié)

    2021-11-15

  • https://github.com/liaogx/fastapi-tutorial.git

    查看全部
  • 版本

    查看全部
  • from datetime import datetime
    from pathlib import Path
    from typing import List, Optional

    from pydantic import BaseModel, ValidationError, constr

    from sqlalchemy import Column, Integer, String
    from sqlalchemy.dialects.postgresql import ARRAY
    from sqlalchemy.ext.declarative import declarative_base

    print("\033[31m1. --- Pydantic的基本用法。Pycharm可以安裝Pydantic插件 ---\033[0m")


    class User(BaseModel):
    ? ?id: int
    ? ?name: str = "john ?snow"
    ? ?signup_ts: datetime
    ? ?friends: List[int] = []


    external_data = {
    ? ?"id": "123",
    ? ?"signup_ts": "2021-08-09 11:12:30",
    ? ?"friends": ["1", 2, 4]
    }

    # if __name__ == '__main__':
    user = User(**external_data)
    print(user.id, user.name)
    print(user.dict())

    print("\033[31m2. --- 校驗(yàn)失敗處理 ---\033[0m")
    try:
    ? ?u = User(id=1, signup_ts=datetime.today(), friends=['not a number', 1])
    ? ?print(u)
    except ValidationError as e:
    ? ?print(e.json())

    print("\033[31m3. --- 模型類的屬性和方法 ?---\033[0m")

    print(user.dict())
    print(user.json())
    print(user.copy())

    # 類方法
    print("類方法")
    print(User.parse_obj(external_data))
    print(User.parse_raw('{"id": 123, "name": "john ?snow", "signup_ts": "2021-08-09T11:12:30", "friends": [1, 2, 4]}'))
    file = Path("pydanic_tutorial.json")
    file.write_text('{"id": 123, "name": "john ?snow", "signup_ts": "2021-08-09T11:12:30", "friends": [1, 2, 4]}')
    print(User.parse_file(file))

    print(user.schema())
    print(user.schema_json())

    # 不校驗(yàn)屬性, 直接構(gòu)造
    print(User.construct(id="sdf", signup_ts=datetime.today(), friends=['not a number', 1]))

    print(User.__fields__.keys())

    print("\033[31m4. --- 遞歸模型 ?---\033[0m")


    class Sound(BaseModel):
    ? ?sound: str


    class Dog(BaseModel):
    ? ?name: str
    ? ?weight: Optional[float] = None
    ? ?sound: List[Sound]


    # dog = Dog(name="hello kitty", weight=1.8, sound=[{"sound": "wangwang~"}, {"sound": "yingying ~"}])
    # print(dog.dict())
    dog1 = Dog(name="hello kitty", weight=1.8, sound=[Sound(sound="wangwang~"), Sound(sound="yingying~")])
    print(dog1.dict())

    print("\033[31m5. --- ORM模型:從類實(shí)例創(chuàng)建符合ORM對(duì)象的模型 ?---\033[0m")

    Base = declarative_base()


    class CompanyOrm(Base):
    ? ?__tablename__ = 'companies'
    ? ?id = Column(Integer, primary_key=True, nullable=False)
    ? ?public_key = Column(String(20), index=True, nullable=False, unique=True)
    ? ?name = Column(String(63), unique=True)
    ? ?domains = Column(ARRAY(String(255)))


    class CompanyModel(BaseModel):
    ? ?id: int
    ? ?public_key: constr(max_length=20)
    ? ?name: constr(max_length=63)
    ? ?domains: List[constr(max_length=255)]

    ? ?class Config:
    ? ? ? ?orm_mode = True


    co_orm = CompanyOrm(
    ? ?id=123,
    ? ?public_key='foobar',
    ? ?name='Testing',
    ? ?domains=['example.com', 'foobar.com'],
    )
    print(CompanyModel.from_orm(co_orm))

    查看全部
  • ASGI協(xié)議的服務(wù)

    • Uvicorn

    • Hypercorn

    • Daphne

    WSGI協(xié)議的服務(wù)

    • uWSGI

    • Gunicorn

    查看全部
  • Starlette, Pydantic和Python的關(guān)系

    http://img1.sycdn.imooc.com//61221cfb000199b614080882.jpg

    查看全部
首頁上一頁1234下一頁尾頁

舉報(bào)

0/150
提交
取消
課程須知
任何想學(xué)習(xí)Python開發(fā)的同學(xué),尤其是需要高效率完成高并發(fā)、高性能項(xiàng)目的同學(xué)都可以學(xué)習(xí)
老師告訴你能學(xué)到什么?
FastAPI 框架特性及性能優(yōu)勢 如何定義各種請(qǐng)求參數(shù)和驗(yàn)證 模板渲染和靜態(tài)文件配置 FastAPI 的表單數(shù)據(jù)處理 全面學(xué)習(xí) FastAPI 依賴注入系統(tǒng) FastAPI 的安全、認(rèn)證和授權(quán) 大型工程應(yīng)該如何目錄結(jié)構(gòu)設(shè)計(jì) FastAPI 的中間件開發(fā)方法和規(guī)范 跨域資源共享的原理和實(shí)現(xiàn)方式

微信掃碼,參與3人拼團(tuán)

微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對(duì)慕課網(wǎng)的支持!