Giter Site home page Giter Site logo

python-learn's Introduction

python-learn

学习fastapi

第一天

创建环境

python3 -m venv venv  
source venv/bin/activate

安装

pip install fastapi_amis_admin 
```
from fastapi import FastAPI
app = FastAPI()

@app.get("/")
async def root():
    return {"Hello": "World"}
if __name__ == '__main__':
    uvicorn.run(app="main:app", host="127.0.0.1", port=8080, reload=True, debug=True)
```
参数	作用
app	运行的 py 文件:FastAPI 实例对象
host	访问url,默认 127.0.0.1
port	访问端口,默认 8080
reload	热更新,有内容修改自动重启服务器
debug	同 reload
reload_dirs	设置需要 reload 的目录,List[str] 类型
log_level	设置日志级别,默认 info

uvicorn运行方式

https://blog.csdn.net/weixin_46248273/article/details/120284287?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-120284287-blog-123818140.235%5Ev40%5Epc_relevant_3m_sort_dl_base2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-120284287-blog-123818140.235%5Ev40%5Epc_relevant_3m_sort_dl_base2&utm_relevant_index=5

python-learn's People

Contributors

wenkaitiantian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.