重启nginx时出现desylment问题

时间:2016-04-07 10:08:51

标签: python django amazon-web-services

我正在使用favfile(https://ashokfernandez.wordpress.com/2014/03/11/deploying-a-django-app-to-amazon-aws-with-nginx-gunicorn-git/comment-page-1/#comment-100)来部署django应用。但是卡在某处。请帮忙,为fabfile提供了一个链接。

Restarting nginx
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] sudo: /etc/init.d/nginx restart
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out: Restarting nginx: nginx.

[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] sudo: source /home/ubuntu/.virtualenvs/bhuv/bin/activate && python /home/ubuntu/webapps/bhuv/manage.py collectstatic -v 0 --noinput
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out: Traceback (most recent call last):
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/home/ubuntu/webapps/bhuv/manage.py", line 11, in <module>
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     execute_from_command_line(sys.argv)
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/home/ubuntu/.virtualenvs/bhuv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     utility.execute()
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/home/ubuntu/.virtualenvs/bhuv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     settings.INSTALLED_APPS
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/home/ubuntu/.virtualenvs/bhuv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     self._setup(name)
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/home/ubuntu/.virtualenvs/bhuv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     self._wrapped = Settings(settings_module)
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/home/ubuntu/.virtualenvs/bhuv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     mod = importlib.import_module(self.SETTINGS_MODULE)
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out:     __import__(name)
[ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com] out: ImportError: No module named prod


Fatal error: sudo() received nonzero return code 1 while executing!

Requested: source /home/ubuntu/.virtualenvs/bhuv/bin/activate && python /home/ubuntu/webapps/bhuv/manage.py collectstatic -v 0 --noinput
Executed: sudo -S -p 'sudo password:'  -u "ubuntu"  /bin/bash -l -c "cd /home/ubuntu/webapps && source /home/ubuntu/.virtualenvs/bhuv/bin/activate && python /home/ubuntu/webapps/bhuv/manage.py collectstatic -v 0 --noinput"

Aborting.
Disconnecting from ec2-52-62-197-135.ap-southeast-2.compute.amazonaws.com... done.

1 个答案:

答案 0 :(得分:2)

您是否在Deploying a Django App to Amazon AWS (with Nginx + Gunicorn + Git)中正确执行了这些步骤?文件settings/prod.py丢失了。请阅读Setting up Our Django Project部分。你有没有运行sudo pip requirements.txt

prod.py for your server Django settings