本文介绍了电线QUOT;如何永久"一个EC2 IP地址在virtualenv中的Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按照教程在的http:// uwsgi -docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html 。我正与在Amazon EC2上使用Ubuntu 14.4实例。我试图部署Django应用程序我已经与python3当地开发。到目前为止,我已经得到了应用程序的工作继啧啧只要我手动ssh登录,打开的virtualenv,然后打开uwsgi,使用:

I'm trying to follow the tutorial at http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html. I am working with an ubuntu 14.4 instance on amazon EC2. I'm trying to deploy a django app I've developed locally with python3. So far I've got the app working following the tut as long as I manually ssh in , turn on the virtualenv and then turn on uwsgi, using :

workon env1
uwsgi --ini /home/ubuntu/mysite_uwsgi.ini

我注意到,不过,当我想今天上午将请求发送到应用程序,我越来越:

I noticed however that when I tried to send a request to the app this morning, that I was getting:

errno 5 input/output error

这解决了我的手动ssh方式连接并执行上面的两行。我不明白这是如何工作完全是,但不知何故,我的virtualenv和uwsgi被停用后,我注销。我需要保持它们的活性,使所有请求可以漏斗我的应用程序。我不知道如何做到这一点。按照上面的啧啧,我已经修改/etc/rc.local中来:

This was solved my manually sshing in and executing the 2 lines above. I don't understand how this works exactly , but somehow my virtualenv and uwsgi were deactivated after I logged off. I need to keep them active so that all requests can be funneled to my app. I don't know how to do this. Following the tut above , I've modified /etc/rc.local to:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

workon myenv
uwsgi --ini /home/ubuntu/mysite_uwsgi.ini


exit 0

这是否会解决我的问题。如果不是我该怎么办?

Will this solve my problem. If not what should I do?

推荐答案

可以的过程:

env = DJANGO_SETTINGS_MODULE=mysite.settings # set an environment variable
pidfile = /tmp/project-master.pid # create a pidfile
harakiri = 20 # respawn processes taking more than 20 seconds
limit-as = 128 # limit the project to 128 MB
max-requests = 5000 # respawn processes after serving 5000 requests
"uwsgi --ini uwsgi.ini --daemonize=/var/log/yourproject.log # background the

这篇关于电线QUOT;如何永久"一个EC2 IP地址在virtualenv中的Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 05:30