Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Try serving your static content from a specialized host, for example firebase hosting.

Then, you don’t need to serve any static content from your API server and can do away with nginx.

Use the whitenoise package for serving the Django admin pages if you still need them for administrative tasks.



Or serve statics from uWSGI (which also provides a spooler, cron and shared cachemem that works with python and Django but that's another story), here in optimized version for best results according to lighthouse:

uwsgi --plugin=python3,http,router_static,router_cache --mime-file /etc/mime.types --offload-threads '%k' --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=7776000' --static-map $STATIC_ROOT=$STATIC_URL --static-gzip-all --cache2 'name=statcalls,items=100' --static-cache-paths 86400 --static-cache-paths-name statcalls"


Sane defaults FTW




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: