You have just decided to use Celery into your Django project and configured it already. All tasks are now created and are running correctly. So you deploy it on a server. Only issue is that logs will refuse to appear in your application server logs and you are losing any log capture for your celery workers.
Worry not! here is a production tested config for you so that your celery logs appear in your server logs in all their glory.
If not already follow my previous guide on how to do Django logging properly. …
If you are working on Django, you might have faced difficulty in configuring logging with a dict in
settings.py file. You go about writing your dict but your values are not valued and have no effect.
There is a very simple solution for this problem and that is properly overriding the logging config so that whatever Django has already configured is replaced with your own best in class(atleast for you) logging config.
Once your site goes live there are some elements out there who keep trying to access your filesystem using an old UNIX hack of trying to hit your site with a path to sock file. Using frameworks like Django can prevent this already if you have your
DISALLOWED_HOST settings set properly to only allow valid hostnames in it. But the first line of defense for this must be the webserver i.e. Nginx. The assumption being here that you are using Nginx as your reverse proxy server.
Depending on your configuration your conf files for Nginx will be in either
Django Rest Framework(DRF) makes it simple to create usual paginated responses for you by just using a
ModelViewSet. For example you can easily create a response like this:
... Your favorite kitten shoes list ...
This is all good and dandy, but what if you want more fields added other than and outside of just the
results serialized by your serializer.
Mind that something similar can also be achieved by using a serializer but serializer won’t be able to help when you want access to request object…