您的WSGIPath指不存在的文件 [英] Your WSGIPath refers to a file that does not exist

查看:1475
本文介绍了您的WSGIPath指不存在的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图上传我的瓶的应用程序AWS不过,我收到这样的错误:

I'm trying to upload my Flask application to AWS however I receive an error on doing so:

您WSGIPath是指不存在的文件。

Your WSGIPath refers to a file that does not exist.

后做一些挖在网上我发现,在.ebextensions文件夹,我应该指定路径。

After doing some digging online I found that in the .ebextensions folder, I should specify the path. There was not a .ebextensions folder so I created one and added the following code to a file named settings.config:

option_settings:
  "aws:elasticbeanstalk:container:python":
    WSGIPath: project/application.py

在WSGIPath是,所以我不知道是什么引起了这种错误的正确路径application.py文件。我是否改变WSGIPath正确的,有没有更好的办法还是有一个问题,别的什么导致这种情况发生?谢谢你。

the WSGIPath is the correct path to the application.py file so I'm not sure what raises this error. Am I changing the WSGIPath right, is there a better way or is there an issue with something else which causes this to happen? Thanks.

推荐答案

有很多,可以用保温瓶部署在AWS上出现的配置问题。我跑了类似的问题,因为你,所以我至少可以告诉你我做了什么来解决WSGI错误。

There's a lot of configuration issues that can arise with Flask deployed on AWS. I was running into a similar issue as you, so I can at least show you what I did to resolve the WSGI error.

首先,显然.ebextensions文件夹不再是必要的(看到这个帖子<一个href="http://stackoverflow.com/questions/20558747/how-to-deploy-structured-flask-app-on-aws-elastic-beanstalk">here.看看davetw12的答案)。相反,(在终端),我浏览到我的项目在同一水平作为我.elasticbeanstalk目录和使用的命令 EB配置。这将打开的选项,你可以设置来配置你的魔豆的应用程序列表。再往这些选项,直到找到WSGI路径。我注意到你有你的设置为项目/ application.py ,但是,这不应该包括该文件夹的参考,只是 application.py 。下面是它的外观在我的Mac终端(WSGI路径是在底部附近)。

First, apparently the .ebextensions folder is no longer necessary (see this post here. and look at davetw12's answer). Instead, (in the Terminal), I navigated to my project at the same level as my .elasticbeanstalk directory and used the command eb config. This will open up a list of options you can set to configure your beanstalk application. Go down through the options until you find the WSGI path. I notice you have yours set to project/application.py, however, this should not include the folder reference, just application.py. Here is how it looks on my Mac in the terminal (WSGI path is near the bottom).

请注意,一旦你那一套,EB可能会重新部署。没关系。让它。

Note that once you get that set, EB will probably redeploy. That's fine. Let it.

一旦你那一套,要进你application.py文件,并确保你打电话给你的应用程序应用程序。例如,我看起来是这样的:

Once you get that set, go into your application.py file and make sure you call your app application. For example, mine looks like this:

from flask import Flask
from flask import render_template
application = Flask(__name__)

@application.route('/')
@application.route('/index')
def index():
    return render_template('index.html',
                           title='Home')

这带走了WSGI路径错误 - 尽管我仍然需要解决下面这个:-)一些其他的问题,但是,这是一组不同的问题。

This took away the WSGI path error - although I still had to fix some other issues following this :-) But that is a different set of questions.

这篇关于您的WSGIPath指不存在的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆