python - Django: 400 Error with Debug=False and ALLOWED_HOSTS=["*"] -


i'm trying run relatively simple django server on python 3.5.3 on ubuntu digitalocean droplet. i'm using gunicorn server nginx. server runs fine when debug=true in settings.py. when set false, 400 error when trying visit page. tried setting allowed_hosts ['*'], still same error. i've looked on lot of forums , many questions on none of solutions have worked.

edit: gunicorn logs, startup

[2016-09-13 00:02:01 +0000] [27160] [debug] current configuration:   nworkers_changed: <function numworkerschanged.nworkers_changed @ 0x7f9ac58d3d90>   worker_class: sync   pre_fork: <function prefork.pre_fork @ 0x7f9ac58c8f28>   limit_request_fields: 100   statsd_host: none   limit_request_field_size: 8190   default_proc_name: kivawebsite.wsgi   capture_output: false   raw_env: []   pidfile: none   pythonpath: none   when_ready: <function whenready.when_ready @ 0x7f9ac58c8d90>   post_worker_init: <function postworkerinit.post_worker_init @ 0x7f9ac58d32f0>   pre_exec: <function preexec.pre_exec @ 0x7f9ac58d37b8>   ca_certs: none   syslog_prefix: none   django_settings: none   sendfile: none   group: 0   limit_request_line: 4094   on_starting: <function onstarting.on_starting @ 0x7f9ac58c8a60>   accesslog: none   statsd_prefix:    threads: 1   max_requests_jitter: 0   graceful_timeout: 30   cert_reqs: 0   proc_name: none   spew: false   loglevel: debug   pre_request: <function prerequest.pre_request @ 0x7f9ac58d3950>   timeout: 30   worker_tmp_dir: none   on_exit: <function onexit.on_exit @ 0x7f9ac58d3f28>   tmp_upload_dir: none   max_requests: 0   keepalive: 2   preload_app: false   logger_class: gunicorn.glogging.logger   syslog_facility: user   forwarded_allow_ips: ['127.0.0.1']   post_request: <function postrequest.post_request @ 0x7f9ac58d3a60>   certfile: none   bind: ['unix:/home/thomas/kivawebsite/kivawebsite.sock']   ssl_version: 3   access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"   errorlog: logs2.log   logconfig: none   umask: 0   proxy_allow_ips: ['127.0.0.1']   reload: false   check_config: false   workers: 1   worker_connections: 1000   syslog_addr: udp://localhost:514   chdir: /home/thomas/kivawebsite   paste: none   keyfile: none   on_reload: <function onreload.on_reload @ 0x7f9ac58c8bf8>   post_fork: <function postfork.post_fork @ 0x7f9ac58d3158>   worker_int: <function workerint.worker_int @ 0x7f9ac58d3488>   backlog: 2048   syslog: false   worker_abort: <function workerabort.worker_abort @ 0x7f9ac58d3620>   worker_exit: <function workerexit.worker_exit @ 0x7f9ac58d3bf8>   daemon: false   user: 0   proxy_protocol: false   config: none   secure_scheme_headers: {'x-forwarded-ssl': 'on', 'x-forwarded-proto': 'https', 'x-forwarded-protocol': 'ssl'}   suppress_ragged_eofs: true   do_handshake_on_connect: false   ciphers: tlsv1   enable_stdio_inheritance: false [2016-09-13 00:02:01 +0000] [27160] [info] starting gunicorn 19.6.0 [2016-09-13 00:02:01 +0000] [27160] [debug] arbiter booted [2016-09-13 00:02:01 +0000] [27160] [info] listening at: unix:/home/thomas/kivawebsite/kivawebsite.sock (27160) [2016-09-13 00:02:01 +0000] [27160] [info] using worker: sync [2016-09-13 00:02:01 +0000] [27163] [info] booting worker pid: 27163 [2016-09-13 00:02:01 +0000] [27160] [debug] 1 workers [2016-09-13 00:02:25 +0000] [27163] [debug] / 

edit: nginx logs show error:

request: "get / http/1.1", upstream: "http://unix:/home/thomas/kivawebsite/kivawebsite.sock:/", host: "104.131.153.181" 2016/09/12 12:06:47 [crit] 22081#22081: *96 connect() unix:/home/thomas/kivawebsite/kivawebsite.sock failed (2: no such file or directory) 

however, have checked , file exists. nginx config file:

server {     listen 80;     server_name 104.131.153.181;      location = /favicon.ico { access_log off; log_not_found off; }     location /static/ {         root /home/thomas/kivawebsite;     }      location / {         include proxy_params;         proxy_set_header host $host;         proxy_pass http://unix:/home/thomas/kivawebsite/kivawebsite.sock;     } } 

is there wrong it?

make sure config in nginx has proper alias using absolute paths (ie: /etc/nginx/sites-enabled) doesn't work if alias done relative path whatever reason.

this appropriate settings nginx @ location / {} section:

proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-proto $scheme; proxy_redirect off; include uwsgi_params; proxy_pass http://unix:/home/thomas/kivawebsite/kivawebsite.sock; 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -