Mattello-uWSGI / django和nginx 400错误请求

时间:2018-11-08 21:44:19

标签: python django nginx uwsgi trello

我正在尝试在Ubuntu 16.04.5 LTS上设置matterllo

当我在没有nginx的情况下通过python manage.py runserver手动运行服务器时,钩子创建成功。

但是,当我尝试通过uWSGI在nginx后面放置东西

LE:用金枪鱼代替nginx遇到同样的问题

delete trello hook :: result=[]
create trello hook :: callback=http://matterllo.x.com:8080/callback/1/ :: board=amazon-argila :: result=False
create trello hook :: callback=http://matterllo.x.com:com:8080/callback/2/ :: board=apiscrm :: result=False
create trello hook :: callback=http://matterllo.x.com:8080/callback/2/ :: board=apiscrm :: result=False

我发现“ False”表示400错误请求

LE:发现是403:

create trello hook :: callback=https://matterllo.x.com:8443/callback/1/ :: board=amazon-argila :: result=URL (https://matterllo.x.com:8443/callback/1/) not reachable. Error: tunneling socket could not be established, statusCode=403 create trello hook :: callback=https://matterllo.x.com:8443/callback/2/ :: board=apiscrm :: result=URL (https://matterllo.x.com:8443/callback/2/) not reachable. Error: tunneling socket could not be established, statusCode=403 create trello hook :: callback=https://matterllo.x.com:8443/callback/2/ :: board=apiscrm :: result=URL (https://matterllo.x.com:8443/callback/2/) not reachable. Error: tunneling socket could not be established, statusCode=403

nginx配置:

server {
    listen 8080;
    server_name matterllo.x.com;

   location / {
    include uwsgi_params;
        uwsgi_ignore_client_abort on;
    uwsgi_pass unix:/home/silviu/uwsgi/trello.sock;
   }
}

uwsgi ini配置:

home = /home/silviu/matterllo/venv
chdir = /home/silviu/matterllo
wsgi-file = /home/silviu/matterllo/matterllo/wsgi.py
logger = file:/home/silviu/uwsgi/sites/trello.log
socket = /home/silviu/uwsgi/trello.sock
vacuum = true
master=true
chown-socket = silviu:www-data
chmod-socket = 666
uid = silviu
gid = www-data
die-on-term = true
module=run:app

/etc/systemd/system/uwsgi.service

[Unit]
Description=uWSGI Emperor service
[Service]
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown silviu:www-data /run/uwsgi'
ExecStart=/usr/local/bin/uwsgi --emperor /home/silviu/uwsgi/sites
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target

这是create hook方法,但是我不认为问题的根源是

 def create_hook(self, callback_url, id_model, desc=None, token=None):
        """
        Creates a new webhook. Returns the WebHook object created.

        There seems to be some sort of bug that makes you unable to create a
        hook using httplib2, so I'm using urllib2 for that instead.
        """
        token = token or self.resource_owner_key

        if token is None:
            raise TokenError("You need to pass an auth token in to create a hook.")

        url = "https://trello.com/1/tokens/%s/webhooks/" % token
        data = {'callbackURL': callback_url, 'idModel': id_model,
                'description': desc}

        response = requests.post(url, data=data, auth=self.oauth)

        if response.status_code == 200:
            hook_id = response.json()['id']
            return WebHook(self, token, hook_id, desc, id_model, callback_url, True)
        else:
            return False

我对Python没有太多经验,但是我认为uWSGI是一个问题。

0 个答案:

没有答案