2016-08-26 4 views
1

우분투 AWS 서버에서 Django 사이트를 호스팅하는 데 문제가 있습니다. 나는 그것을 모두 로컬 호스트에서 잘 실행하도록한다.AWS에 장고를 배포 할 때 누락 된 모듈 Ubuntu EC2

나는이 지침에 따라 오전 : https://github.com/ialbert/biostar-central/blob/master/docs/deploy.md

내가 사용하려고 AWS 콘솔에서 실행할 때 내가 사용하는 경우 다음

1. No module named simple_wsgi 

:

waitress-serve --port 8080 live.deploy.simple_wsgi:application 

내가 가져 오기 오류 기본 설정 파일 (잘라내 지 않은 파일), 가져 오기 오류가 발생합니다.

1. No module named logger 

설정 파일을 이동하고 설정 파일을 deploy.env 및 deploy.py에 복사 한 다음 sample.env 및 sample.py를 복사하려고 시도했지만 실행하지 못했습니다. 도와주세요

+1

는 첫 번째 경우에서 누락 된 의존성이다 :

여기 내 스크립트입니다. "pip install simple_wsgi"를 사용하거나 구성 파일에 simple_wsgi를 언급하십시오. –

답변

0

나는 동일한 문제가 있었고 opened it in Biostar project.

어떻게 수정 했나요? gunicornnginx을 통해 애플리케이션을 제공했습니다.

cp live/staging.env live/deploy.env 
cp live/staging.py live/deploy.py 
# Replace the value of DJANGO_SETTINGS_MODULE to "live.deploy" thanks to http://stackoverflow.com/a/5955623/535203 
sed -i -e '/DJANGO_SETTINGS_MODULE=/ s/=.*/=live.deploy/' live/deploy.env 
[[ -n "$BIOSTAR_HOSTNAME" ]] && sed -i -e "/BIOSTAR_HOSTNAME=/ s/=.*/=$BIOSTAR_HOSTNAME/" live/deploy.env 
source live/deploy.env 
biostar.sh init import 
# Nginx config based on http://docs.gunicorn.org/en/stable/deploy.html and https://github.com/ialbert/biostar-central/blob/production/conf/server/biostar.nginx.conf 
tee "$LIVE_DIR/nginx.conf" <<EOF 
worker_processes 1; 

user nobody nogroup; 
# 'user nobody nobody;' for systems with 'nobody' as a group instead 
pid /tmp/nginx.pid; 
error_log /tmp/nginx.error.log; 

events { 
    worker_connections 1024; # increase if you have lots of clients 
    accept_mutex off; # set to 'on' if nginx worker_processes > 1 
    # 'use epoll;' to enable for Linux 2.6+ 
    # 'use kqueue;' to enable for FreeBSD, OSX 
} 

http { 
    include /etc/nginx/mime.types; 
    # fallback in case we can't determine a type 
    default_type application/octet-stream; 
    access_log /tmp/nginx.access.log combined; 
    sendfile on; 

    upstream app_server { 
    # fail_timeout=0 means we always retry an upstream even if it failed 
    # to return a good HTTP response 

    # for UNIX domain socket setups 
    server unix:/tmp/biostar.sock fail_timeout=0; 

    # for a TCP configuration 
    # server 192.168.0.7:8000 fail_timeout=0; 
    } 

    server { 
    # if no Host match, close the connection to prevent host spoofing 
    listen 8080 default_server; 
    return 444; 
    } 

    server { 
    # use 'listen 80 deferred;' for Linux 
    # use 'listen 80 accept_filter=httpready;' for FreeBSD 
    listen 8080; 
    client_max_body_size 5M; 

    # set the correct host(s) for your site 
    server_name $SITE_DOMAIN; 

    keepalive_timeout 25s; 

    # path for static files 
    root $LIVE_DIR/export/; 
    location = /favicon.ico { 
     alias $LIVE_DIR/export/static/favicon.ico; 
    } 

    location = /sitemap.xml { 
     alias $LIVE_DIR/export/static/sitemap.xml; 
    } 

    location = /robots.txt { 
     alias $LIVE_DIR/export/static/robots.txt; 
    } 

    location /static/ { 
     autoindex on; 
     expires max; 
     add_header Pragma public; 
     add_header Cache-Control "public"; 
     access_log off; 
    } 

    location/{ 
     # checks for static file, if not found proxy to app 
     try_files \$uri @proxy_to_app; 
    } 

    location @proxy_to_app { 
     proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; 
     # enable this if and only if you use HTTPS 
     # proxy_set_header X-Forwarded-Proto https; 
     proxy_set_header Host \$http_host; 
     # we don't want nginx trying to do something clever with 
     # redirects, we set the Host: header above already. 
     proxy_redirect off; 
     proxy_pass http://app_server; 
    } 
    } 
} 
EOF 

gunicorn -b unix:/tmp/biostar.sock biostar.wsgi & 
# Start Nginx in non daemon mode thanks to http://stackoverflow.com/a/28099946/535203 
nginx -g 'daemon off;' -c "$LIVE_DIR/nginx.conf"