full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

Celery and ide debug mode configuration.

Open matejko94 opened this issue 4 years ago • 1 comments

I couldn't figure out why we use Celery ? I have read in documentation that it is used for workers that can import and use models and code from the rest of the backend selectively. This doesn't tell me anything..

Is there any possibility to debug it from ide (like Pyhcharm etc). For now I am using a lot of logging and it is a bit challenging.

Also how to change from config: dev, stg and prod environment ?

matejko94 avatar Jul 19 '21 12:07 matejko94

this is a skeleton framework showcasing fastapi in a close-to-real scenario. celery is a good worker allowing you to truly do long running tasks with a much higher reliability and control vs forexamples fastapis backgroundtasks. however this repo is hollow and it has users and items as far as i remember. crudding those hardly require a robust worker, but having it up and running allows you to do heavy lifts while your apis are offloaded. i used this for computervision, firing up a celery worker with fallbacks and handling, scalable across your docker stack.

however your questions are: 1)why are we using celery (rant above) 2) can you debug "it". and by it i take it you mean the worker. and yes you can :) you should set your wsgi to debug. and celery workets to loglevel debug. https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/490c554e23343eec0736b06e59b2108fdd057fdc/%7B%7Bcookiecutter.project_slug%7D%7D/backend/app/worker-start.sh#L6

  1. how to change from dbg to prod etc. this is as mentioned an example and thus dev, prod and stage are implemented. however, by reading the docs you see that you can fire up a dev env via dock-comp instead of running the entire stack. you should also check out the env. https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/490c554e23343eec0736b06e59b2108fdd057fdc/%7B%7Bcookiecutter.project_slug%7D%7D/frontend/.env#L8

take a minute and plow through the extensive docs and check out the solved issues. most of whats being asked has already been answered :) happy coding!

haviduck avatar Jul 26 '21 03:07 haviduck