gunicorn django static files

  1. Install Gunicorn: Gunicorn can be installed using pip with the command "pip install gunicorn".

  2. Create a Gunicorn configuration file: This file should be created in the project directory with the name "gunicorn.conf.py". It should contain the configuration settings for Gunicorn.

  3. Configure Gunicorn settings: Inside the "gunicorn.conf.py" file, configure the settings such as the number of workers, binding host, and port number.

  4. Collect static files: Use the command "python manage.py collectstatic" to collect all static files into the directory specified in the STATIC_ROOT setting.

  5. Configure Nginx to serve static files: In the Nginx configuration, add a location block to serve the static files directly.

  6. Restart Gunicorn and Nginx: After making changes to the Gunicorn configuration and Nginx, restart both services to apply the changes.