Fetching static files failed with 404 in nginx

You should use alias instead of root. root appends the trailing URL parts to your local path (e.g. http://test.ndd/trailing/part, it will add /trailing/part to your local path). Instead of that, alias does exactly what you want: when http://test.ndd/static/ is requested, /static is mapped to your alias exactly, without appending static again. For example: location /static … Read more

How to use environment variables with supervisor, gunicorn and django (1.6)

OK, I guess I got it. I had tried including environment=SECRET_KEY=”secret_key_with_non_alphanumeric_chars” in the conf file for supervisor but it didn’t like the non alphanumeric chars and I didn’t want to have my key in the conf file as I have it in git. After loking at supervisor’s docs I had also tried with: HOME=”/home/django”, USER=”django” … Read more

Running Django with Gunicorn – Best Practice

After checking out I’d say that the best way is using gunicorn + wsgi $ gunicorn project.wsgi:application It’s now both confirmed in gunicorn docs: if you run Django 1.4 or newer, it’s highly recommended to simply run your application with the WSGI interface using the gunicorn command and django as linked above. It also avoids … Read more

Syntax error installing gunicorn

The error can be ignored, your gunicorn package installed successfully. The error is thrown by a bit of code that’d only work on Python 3.3 or newer, but isn’t used by older Python versions that Gunicorn supports. See https://github.com/benoitc/gunicorn/issues/788: The error is a syntax error happening during install. It is harmless. During installation the setup.py … Read more

Django: Difference between using server through manage.py and other servers like gunicorn etc. Which is better?

nginx and gunicorn are probably the most popular configuration for production deployments. Before detailing why gunicorn is recommended over runserver, let’s quickly clarify the difference between nginx and gunicorn, because both state that they are web servers. NGINX should be your entrance point to the public, it’s the server listening to port 80 (http) and … Read more

django- nginx: [emerg] open() “/etc/nginx/proxy_params” failed (2: No such file or directory) in /etc/nginx/sites-enabled/myproject:11

You’re getting the path wrong for proxy_params 99% of the time (From my experience), the default location for the proxy_params file is /etc/nginx/proxy_params but that doesn’t seem to be the same for you. The proxy_params file contains the following: proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; These parameters are used … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)