Giter VIP home page Giter VIP logo

talkpython / web-applications-with-fastapi-course Goto Github PK

View Code? Open in Web Editor NEW
338.0 16.0 196.0 3.92 MB

Demo code and other handouts for students of our FastAPI Web Apps course.

Home Page: https://training.talkpython.fm/courses/full-html-web-applications-with-fastapi

License: MIT License

Python 73.20% CSS 26.80%
fastapi webapp website sqlalchemy sqlalchemy-orm async-await asyncio static html

web-applications-with-fastapi-course's People

Contributors

mikeckennedy avatar mtgeekman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

web-applications-with-fastapi-course's Issues

aiofiles not needed as a requirement

In Chapter 4, Static files, you show a ModuleNotFoundError: No module named 'aiofiles' error when mounting static files with app.mount('/static', StaticFiles(directory='static'), name='static')

I'm not getting that error and when I run pip list I'm not seeing aiofiles listed. Do you think Starlette updated StaticFiles to use something else?

Testing

How do you write Unit tests for the database, when you define it this way?

Basic App Output

Hi Mike,

Not sure why but the output I'm getting from the basic app does not display the JSON, Raw Data, etc. fastAPI tabs at the top of the browser window like your example shows.

Do you know why that might be?

Mine:
Screen Shot 2021-03-10 at 21 17 31

Yours:
Screen Shot 2021-03-10 at 21 16 43

Thanks
Michael

Modifying .pt files and having Uvicorn reload

Hi Michael,

Great presentation! I was wondering if it is possible to have Uvicorn reload when you make changes to the templates just like it does when you make changes to the .py files?

Thanks in advanced!

Error in engine.py, using python3.9 (posixpath.py) when template_path is None

Hello, got this error trying to run using ch5-viewmodels from TalkPython Course... template_path is None.

I believe the problem is that fastapi_chameleon.global_init() is called after from fastapi_chameleon import template in home.py

Exception has occurred: TypeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
expected str, bytes or os.PathLike object, not NoneType
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/site-packages/fastapi_chameleon/engine.py", line 72, in response_inner
    if not os.path.exists(os.path.join(template_path, template_file)):
  File "/home/cristiana/AAA-wip/Cursos-Programming/Curso-TalkPython-FastAPI-FullWeb/web-applications-with-fastapi-cris/views/home.py", line 13, in <module>
    def index(request: Request):
  File "/home/cristiana/AAA-wip/Cursos-Programming/Curso-TalkPython-FastAPI-FullWeb/web-applications-with-fastapi-cris/main.py", line 7, in <module>
    from views import home
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/cristiana/anaconda3/envs/fastapi/lib/python3.9/runpy.py", line 197, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,

pysqlite3 doesn't support asyncio

It seems the latest sqlalchemy beta release now does as better check for sqlite async support (or you have a different version of sqlite). I'm using python 3.8 and when I get to Chapter 8 I get the following error message after adding create_async_engine, etc.

sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'pysqlite' is not async.

Last login

Hello!

Where is proper place to specify logic for last login?
Is it some service put_last_login_by_user_id(user_id) which is called in LoginViewModel or something else?

Thank you

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.