2016-04-07 103 views
0

我正在使用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提供了一个链接。重新启动nginx时aws depoylment问题

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

这不是一个特别的django问题 - 这是一个serverfault类型的问题,你可能会找到一个类似的问题。 :)我建议把它移到那里。 – Withnail

+0

确保你已经创建了'settings/__ init __。py'和'settings/prod.py'文件。这可能是值得再次教程,特别是提到'prod'的任何部分。 – Alasdair

回答

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 
+0

谢谢,我在init文件中忘了下划线。仍然我得到枕头错误,因为它需要libjpeg库。我如何将libjpeg需求放在common.txt文件中,以便它可以安装在server.Locally我工作正常 –