How to run starlette local

Hello,

I am trying to test out Howards Bears classifier locally before I deploy it to google cloud. From looking over the Starlette documentation it looks like you run the local server using the command uvicorn example:App - in our case we would run uvicorn server:app

I did this and it looks to start calling the code in server.py but gets jammed up on line 21

app.mount('/static', StaticFiles(directory='app/static'))

The error I keep getting is this ‘RuntimeError: Directory ‘app/static’ does not exist’

This is a bit odd as the directory clearly does exist in my folder so not sure why it’s failing. Any ideas?

I am thinking about switching over to Flask as there is a ton more documentation and community around that framework and starlette has been not super intuitive so far.

Please ignore this - I was running the incorrect command when attempting to start the local server - should have been running python app/server.py serve

2 Likes

I cant run the app locally. cant import fast.vision even after sys.append .path
it imports fine on jupyter notebook but not here.

\fastai\webApp\google-app-engine>python app/server.py serve
Traceback (most recent call last):
File “app/server.py”, line 10, in
from fastai.vision import *
ModuleNotFoundError: No module named ‘fastai.vision’

you need to confirm where all your site-packages are located on your file system.

I was having an issue with pip vs pip3 even though I only have python3 installed, one is 3.7 the other is 3.8.

Confirm where it is installed or just install it with both pip and pip3.