この質問は何度も寄せられており、悲しいことに、スタックのデプロイに関するすべてのソリューションを試しました。これは必死です。私はここで質問を繰り返します。
私の展開シナリオ:
/srv .
├── env
│ ├── bin
│ ├── include
│ │ ├── python2.7 -> /usr/include/python2.7
│ │ └── site
│ ├── lib
│ │ └── python2.7
│ ├── local
│ │ ├── bin -> /srv/env/bin
│ │ ├── include -> /srv/env/include
│ │ └── lib -> /srv/env/lib
│ └── src
│ ├── authorizesauce
│ ├── couchdb
│ ├── django-haystack
│ └── django-js-utils
├── html
├── http
├── log
├── solr
├── ssl
└── www
└── SC
└── webapp
└── core
└── individual
ログ ファイル ストレージ用/srv/env
の仮想環境
はどこですか。私の Django アプリケーションの私のファイルは、ssl 関連のすべてのファイルにあり、展開用であり、使用されていません。 /srv/log
uwsgi reload
/srv/reload
/srv/www/SC/webapp
/srv/ssl
/srv/solr
apache solr
/srv/html
/srv/http
/srv/www/SC/webapp
フォルダはsettings.py
manage.py
/srv/www/SC/webapp/core/
はコア アプリケーション フォルダですindividual
。AbstractUser
nginx
バージョンは、
Amazon AWS でホストされて いる1.1.19
uwsgi
バージョンです。1.9.18.2
operating system
ubuntu 1.04 LTS 64 bit
uwsgi構成
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /srv/www/SC/webapp
# the virtualenv (full path)
virtualenv = /srv/env
env = DJANGO_SETTINGS_MODULE = settings
# Django's wsgi file
module = uwsgi
master = true
#multithreading
enable-threads = true
# maximum number of worker processes
processes = 4
# the socket (use the full path to be safe
socket = /tmp/dev.sc.com.sock
# ... with appropriate permissions - may be needed
chmod-socket = 664
# clear environment on exit
vacuum = true
#pythonpath
pythonpath = /srv/www/SC/webapp
pythonpath = /srv/www/SC/webapp/settings.py
pythonpath = /srv/www/SC/webapp/core
pythonpath = /srv/www/SC/webapp/core/individual
#reloadfile
touch-reload = /srv/reload
uwsgi ファイル
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
nginx構成
upstream django {
server unix:/tmp/dev.sc.com.sock;
}
server {
listen 80;
rewrite ^ https://sc.com$request_uri? permanent;
}
server {
listen 443;
server_name .sc.com;
ssl on;
ssl_certificate /srv/ssl/sc.bundle.crt;
ssl_certificate_key /srv/ssl/sc.key;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /srv/www/SC/webapp/media;
}
location /static {
alias /srv/www/SC/webapp/site_static;
}
location / {
uwsgi_pass unix:/tmp/dev.sc.com.sock;
uwsgi_read_timeout 6000;
uwsgi_send_timeout 6000;
include /etc/nginx/uwsgi_params;
index index.html index.htm;
uwsgi_param X-Forwarded-Proto https;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param Host $http_host;
}
}
問題
アプリケーションで実行するとpython manage.py runserver
、完全に正常に動作します。展開がレイズに切り替えられると
すぐにuwsgi
ImproperlyConfigured("AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL)
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'individual.Individual' that has not been installed
表示され始めますが、非常にランダムに、時々うまくいきます (50% の時間のように)。何が問題なのかわかりません。
問題 2
はこれらのuwsgi
ログを示します
unable to load app 0 (mountpoint='') (callable not found or import error)
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x199c500 pid: 28242 (default app)
完全なログ
[uWSGI] getting INI configuration from /srv/www/SC/webapp/wsgi.working.ini
*** Starting uWSGI 1.9.18.2 (64bit) on [Mon Oct 28 15:57:49 2013] ***
compiled with version: 4.6.3 on 28 October 2013 12:58:05
os: Linux-3.2.0-54-virtual #82-Ubuntu SMP Tue Sep 10 20:31:18 UTC 2013
nodename: ip-10-168-14-146
machine: x86_64
clock source: unix
detected number of CPU cores: 2
current working directory: /srv/www/SC/webapp
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 59476
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/dev.sc.com.sock fd 3
Python version: 2.7.3 (default, Sep 26 2013, 20:13:52) [GCC 4.6.3]
Set PythonHome to /srv/env
Python main interpreter initialized at 0x199c500
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 364000 bytes (355 KB) for 4 cores
*** Operational MODE: preforking ***
added /srv/www/SC/webapp/ to pythonpath.
added /srv/www/SC/webapp/settings.py to pythonpath.
added /srv/www/SC/webapp/core/ to pythonpath.
added /srv/www/SC/webapp/core/individual/ to pythonpath.
unable to load app 0 (mountpoint='') (callable not found or import error)
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x199c500 pid: 28242 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 28242)
spawned uWSGI worker 1 (pid: 28243, cores: 1)
spawned uWSGI worker 2 (pid: 28244, cores: 1)
spawned uWSGI worker 3 (pid: 28245, cores: 1)
spawned uWSGI worker 4 (pid: 28246, cores: 1)
どんな指針も大いに役立つでしょう。
まとめられることはすべて話しました。