前提・実現したいこと
djangoアプリをAWSのEC2にデプロイしたいです。
サーバーはnginxを使っています。
またuWSGIであげようとしています。
また仮想環境はvirtualenvで作っています。
よろしくお願いします。
発生している問題・エラーメッセージ
nginx、wsgiのプロセスは動いているのですが、localhostでもアプリを動かすことができません。
curlを叩くと301とでてしまいます。
**
log (uwsgiのlogです)**
***** Starting uWSGI 2.0.14 (64bit) on [Sat Feb 11 11:32:37 2017] *****
compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 11 February 2017 00:29:19
os: Linux-4.4.41-36.55.amzn1.x86_64 #1 SMP Wed Jan 18 01:03:26 UTC 2017
nodename: ip-172-31-26-15
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /opt/app
detected binary path: /opt/app/venv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /opt/app/apolo_api/
your processes number limit is 3896
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uWSGI http bound on :5000 fd 3
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 6
Python version: 3.5.1 (default, Sep 13 2016, 18:48:37) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
Set PythonHome to /opt/app/venv/
Python main interpreter initialized at 0xe1fdb0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 166112 bytes (162 KB) for 2 cores
*** Operational MODE: threaded ***
added /opt/app/apolo_api/ to pythonpath.
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xe1fdb0 pid: 3840 (default app)
mountpoint already configured. skip.
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 3840)
spawned uWSGI worker 1 (pid: 3842, cores: 2)
*** Stats server enabled on /tmp/uwsgi.stats.sock fd: 13 ***
spawned uWSGI http 1 (pid: 3843)
{address space usage: 461803520 bytes/440MB} {rss usage: 47558656 bytes/45MB} [pid: 3842|app: 0|req: 1/1] 172.31.26.15 () {28 vars in 415 bytes} [Sat Feb 11 02:32:58 2017] GET /api/v1/judge?sentences=つらたん => generated 26 bytes in 170 msecs (HTTP/1.1 400) 1 headers in 53 bytes (1 switches on core 0)
400とでてしまいます。
またローカルでcurlを叩くと
[ec2-user@ip-172-31-26-15 app]$ curl -i http://127.0.0.1:8000/api/v1/judge?sentences=つらたん
HTTP/1.0 301 Moved Permanently
Date: Sat, 11 Feb 2017 02:41:38 GMT
Server: WSGIServer/0.2 CPython/3.5.1
Location: /api/v1/judge/?sentences=%C3%A3%C2%81%C2%A4%C3%A3%C2%82%C2%89%C3%A3%C2%81%C2%9F%C3%A3%C2%82%C2%93
Content-Type: text/html; charset=utf-8
301がでてしまいます。
これをローカル、本番でも動くようにしたいです。
よろしくお願いします。
あなたの回答
tips
プレビュー