我正在为Heroku上的Django应用程序寻找一个有效的uwsgi配置。
目前我有
uWSGI==1.4.4
<{1>}中的和
requirements.txt
# this is in a single line:
web: uwsgi --http-socket=$PORT --home=$HOME
--module="myapp.wsgi:application"
--master --vacuum --processes=1 --plugins=python
--virtualenv="/app/.heroku/python/"
中的。但这失败了:
Procfile
我猜第二个错误(2013-01-15T11:48:17+00:00 app[web.1]: open("./python_plugin.so"): No such file or directory [core/utils.c line 4733]
2013-01-15T11:48:17+00:00 app[web.1]: machine: x86_64
2013-01-15T11:48:17+00:00 app[web.1]: !!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: No such file or directory !!!
2013-01-15T11:48:17+00:00 app[web.1]: nodename: 71650ed5-006c-4395-8be5-276408f42efb
2013-01-15T11:48:17+00:00 app[web.1]: os: Linux-2.6.32-350-ec2 #57-Ubuntu SMP Thu Nov 15 15:59:03 UTC 2012
2013-01-15T11:48:17+00:00 app[web.1]: *** Starting uWSGI 1.4.4 (64bit) on [Tue Jan 15 11:48:17 2013] ***
2013-01-15T11:48:17+00:00 app[web.1]:
lock engine: pthread robust mutexes
2013-01-15T11:48:17+00:00 app[web.1]: detected max file descriptor number: 10000
2013-01-15T11:48:17+00:00 app[web.1]: current working directory: /app
2013-01-15T11:48:17+00:00 app[web.1]: detected binary path: /app/.heroku/python/bin/uwsgi
2013-01-15T11:48:17+00:00 app[web.1]: your processes number limit is 256
2013-01-15T11:48:17+00:00 app[web.1]: detected number of CPU cores: 4
2013-01-15T11:48:17+00:00 app[web.1]: uwsgi socket 0 bound to UNIX address 25699 fd 3
2013-01-15T11:48:17+00:00 app[web.1]: clock source: unix
2013-01-15T11:48:17+00:00 app[web.1]: *** Operational MODE: single process ***
2013-01-15T11:48:17+00:00 app[web.1]: compiled with version: 4.4.3 on 15 January 2013 11:11:38
2013-01-15T11:48:17+00:00 app[web.1]: Python version: 2.7.2 (default, Oct 31 2011, 16:22:04) [GCC 4.4.3]
2013-01-15T11:48:17+00:00 app[web.1]: Set PythonHome to /app/.heroku/python/
2013-01-15T11:48:17+00:00 app[web.1]: your memory page size is 4096 bytes
2013-01-15T11:48:17+00:00 app[web.1]: Python main interpreter initialized at 0x123dd80
2013-01-15T11:48:17+00:00 app[web.1]: *** Python threads support is disabled. You can enable it with --enable-threads ***
2013-01-15T11:48:17+00:00 app[web.1]: your server socket listen backlog is limited to 100 connections
2013-01-15T11:48:17+00:00 app[web.1]: mapped 144784 bytes (141 KB) for 1 cores
2013-01-15T11:48:17+00:00 app[web.1]: Traceback (most recent call last):
2013-01-15T11:48:17+00:00 app[web.1]: File "./myapp/wsgi.py", line 23, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 8, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: from django.core.wsgi import get_wsgi_application
2013-01-15T11:48:17+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 1, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: from django import http
2013-01-15T11:48:17+00:00 app[web.1]: from django.core.handlers.wsgi import WSGIHandler
2013-01-15T11:48:17+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/http/__init__.py", line 116, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: from django.utils.crypto import constant_time_compare, salted_hmac
2013-01-15T11:48:17+00:00 app[web.1]: from django.core import signing
2013-01-15T11:48:17+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/crypto.py", line 13, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/signing.py", line 42, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: from os import urandom as _urandom
2013-01-15T11:48:17+00:00 app[web.1]: ImportError: cannot import name urandom
2013-01-15T11:48:17+00:00 app[web.1]: import random
2013-01-15T11:48:17+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/random.py", line 47, in <module>
2013-01-15T11:48:17+00:00 app[web.1]: *** no app loaded. going in full dynamic mode ***
2013-01-15T11:48:17+00:00 app[web.1]: unable to load app 0 (mountpoint='') (callable not found or import error)
2013-01-15T11:48:17+00:00 app[web.1]: spawned uWSGI master process (pid: 2)
2013-01-15T11:48:17+00:00 app[web.1]: *** uWSGI is running in multiple interpreter mode ***
2013-01-15T11:48:17+00:00 app[web.1]: spawned uWSGI worker 1 (pid: 3, cores: 1)
2013-01-15T11:49:17+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-01-15T11:49:17+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-01-15T11:49:18+00:00 heroku[web.1]: Process exited with status 137
2013-01-15T11:49:18+00:00 heroku[web.1]: State changed from starting to crashed
)可能是第一个错误的结果(ImportError: cannot import name urandom
)
该应用程序适用于默认的Django devel HTTP服务器。
任何想法如何解决这个问题?指向工作配置非常受欢迎。