阅读背景:

AWS Elastic Beanstalk上的Django 1.7 - 应用程序未运行,只能看到“Index Of /”

来源:互联网 

I'm trying to deploy this repo to Elastic Beanstalk: https://github.com/jordanmessina/test_beanstalk/tree/5e9a919d991adf22bce1a9b8f6c1515e83b1babb with this configuration: 64bit Amazon Linux 2014.09 v1.0.9 running Python 2.7

我正在尝试使用此配置将此repo部署到Elastic Beanstalk:https://github.com/jordanmessina/test_beanstalk/tree/5e9a919d991adf22bce1a9b8f6c1515e83b1babb:64位运行Python 2.7的Amazon Linux 2014.09 v1.0.9

I'm getting the following error on deployment:

我在部署时遇到以下错误:

ERROR: [Instance: i-2eb19dc2 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/EbExtensionPostBuild] command failed with error code 1: Error occurred during build: Command 01_syncdb failed.

When I go to the webpage after deployment, all I see is: Index of /

当我在部署后进入网页时,我看到的是:索引/

Is there something wrong with my configuration file?

我的配置文件有问题吗?

UPDATE

UPDATE

I made some changes and managed to get the app running and 500ing (progress).

我做了一些更改,并设法让应用程序运行和500ing(进度)。

I've poked around on the instances the code is deployed to. I've narrowed the issue down to the mod_wsgi pythonpath that's setup. Here's the configuration:

我已经在代码部署到的实例上四处寻找。我已经将问题缩小到设置的mod_wsgi pythonpath。这是配置:

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On

<VirtualHost *:80>

Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static/>
Order allow,deny
Allow from all
</Directory>


WSGIScriptAlias / /opt/python/current/app/webapp/beanstalk/wsgi.py


<Directory /opt/python/current/app/>
  Require all granted
</Directory>

WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
  python-path=/opt/python/current/app:/opt/python/run/venv/lib/python2.7/site-packages user=wsgi group=wsgi \
  home=/opt/python/current/app
WSGIProcessGroup wsgi
</VirtualHost>

I also found the logs for the httpd process (standard /var/log/httpd/error_log for future reference) and was tailing them to see what the issue was. The problem was an ImportError with beanstalk.settings (because it's not on the path).

我还找到了httpd进程的日志(标准/ var / log / httpd / error_log以供将来参考),并且正在跟踪它们以查看问题所在。问题是带有beanstalk.settings的ImportError(因为它不在路径上)。

Now I'm trying to think of a sane way to keep my app structure (webapp directory in the root containing my django app) and update the python path for mod_wsgi so this thing works...I'm very frustrated with the opinionated app structure that Elastic Beanstalk is trying to push on me. Any suggestions would be great!

现在我正在尝试一种理智的方式来保持我的应用程序结构(包含我的django应用程序的根目录中的webapp目录)并更新mod_wsgi的python路径,这样这个东西有效......我对自以为是的应用感到非常沮丧Elastic Beanstalk试图推动我的结构。任何建议都会很棒!

1 个解决方案

#1


0  

You can't have the DB locally on elastic beanstalk as you are attempting. EB is meant just as an application container, what you have there will try and setup SQLite on the system, which beanstalk isn't gonna let you do.

当您尝试时,您不能在弹性beanstalk上本地使用DB。 EB就像一个应用程序容器,你在那里将尝试在系统上设置SQLite,beanstalk不会让你这么做。

You need to configure Django to point to some DB off the beanstalk, there is no DB on that instance and your Django config doesn't seem to have any DB configured on it as you seem to just be trying to use the included SQLite DB, which I'd imagine they don't let you install that on beanstalk, so why not try configuring an another DB or using no DB at all, if possible.

您需要将Django配置为指向Beanstalk上的某个DB,该实例上没有DB,并且您的Django配置似乎没有配置任何DB,因为您似乎只是尝试使用包含的SQLite DB,我想他们不会让你在beanstalk上安装它,所以如果可能的话,为什么不尝试配置另一个DB或者根本不使用DB。

I'd spin up a small RDS instance and configure my Django app to tie into that. That should allow you to sync the DB and get started. It also might be a matter of SQLite not being on the system, so you'd have to configure EB to install that if it's even possible.

我将启动一个小型RDS实例并配置我的Django应用程序。这应该允许您同步数据库并开始使用。它也可能是SQLite不在系统上的问题,所以如果可能的话,你必须配置EB来安装它。


分享到: