简体   繁体   English

Django AWS Elastic-Beanstalk WSGI.py配置

[英]Django AWS Elastic-Beanstalk WSGI.py configuration

I am currently setting up a django application with python3 on AWS Elastic-Beanstalk, but I am having issues with configuring the wsgi.py file for the application. 我目前在AWS Elastic-Beanstalk上使用python3设置django应用程序,但是在为该应用程序配置wsgi.py文件时遇到问题。 Why am I having the error: ERROR: Your WSGIPath refers to a file that does not exist. 为什么出现错误: ERROR: Your WSGIPath refers to a file that does not exist. ?

When running eb config I set the wsgi path to WSGIPath: pronet/pronet/src/pronet/wsgi.py 运行eb config时,我将wsgi路径设置为WSGIPath: pronet/pronet/src/pronet/wsgi.py

Is the issue with my wsgi.py script, eb config wsgi settings, or not having the django module installed? 我的wsgi.py脚本, eb config wsgi设置是否有问题,或者没有安装django模块

WSGI.py Script WSGI.py脚本

"""
WSGI config for pronet project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pronet.settings.production")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Wrap werkzeug debugger if DEBUG is on
from django.conf import settings
if settings.DEBUG:
    try:
        import django.views.debug
        import six
        from werkzeug.debug import DebuggedApplication

        def null_technical_500_response(request, exc_type, exc_value, tb):
            six.reraise(exc_type, exc_value, tb)

        django.views.debug.technical_500_response = null_technical_500_response
        application = DebuggedApplication(application, evalex=True,
                                          # Turning off pin security as DEBUG is True
                                          pin_security=False)
    except ImportError:
        pass

ElasticbeanStalk eb logs output file ElasticbeanStalk eb日志输出文件

[Tue Oct 18 18:59:52.882790 2016] [:error] [pid 25763] 
[remote 172.31.5.99:148] mod_wsgi (pid=25763): 
    Exception occurred processing WSGI script 
'/opt/python/current/app/pronet/src/pronet/wsgi.py'.


[Tue Oct 18 20:01:21.096064 2016] [:error] [pid 25763] 
    [remote 172.31.46.245:148] ImportError: No module named 'django'
[Tue Oct 18 20:01:21.478180 2016] [:error] [pid 25763] 
    [remote 172.31.46.245:60132] mod_wsgi (pid=25763): 
    Target WSGI script '/opt/python/current/app/pronet/src/pronet/wsgi.py' 
    cannot be loaded as PytExamine: sing WSGI script  '/opt/python/current/app/pronet/src/pronet/wsgi.py'.

Project Directory "Pronet/pronet/src/pronet/wsgi.py" 项目目录“ Pronet / pronet / src / pronet / wsgi.py”

在此处输入图片说明

I changed the wsgi path to WSGIPath: pronet/src/pronet/wsgi.py , and now I received this message in the eb logs. 我将wsgi路径更改为WSGIPath:pronet / src / pronet / wsgi.py ,现在我在eb日志中收到了此消息。 Does this mean the wsgi.py is found? 这是否意味着找到了wsgi.py?

[Tue Oct 18 20:53:09.711239 2016] [so:warn] [pid 31697] AH01574: module wsgi_module is already loaded, skipping

This is usually due to the way your app directory is structured. 这通常是由于您应用目录的结构方式所致。 Most of the time its due to the method you use to zip the folder for deployment. 大多数情况下,这是由于您使用的方法来压缩文件夹以进行部署。 Instead of zipping the parent folder, try to select the items inside root directory and then zip. 而不是压缩父文件夹,请尝试选择根目录中的项目,然后压缩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM