简体   繁体   中英

Deploying django project on AWS elastic beanstalk

I am following the tutorial for deploying a django project on AWS elastic beanstalk here: http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

My app works when I test locally but when I deploy, I'm getting a 404 error. Looking at the event logs, I see this message:

Error running user's commands : An error occurred running '. /opt/python/ondeck/env && PYTHONPATH=/opt/python/ondeck/app: django-admin.py syncdb --noinput' (rc: 127) /bin/sh: django-admin.py: command not found

That leads me to believe that the tutorial is missing a part about installing django files on the server or at least configuring my project to recognize django-admin.py. I have django installed on my local machine so it works there.

I know python support is brand new for elastic beanstalk but has anyone deployed django to it?

我相信您不需要将container_commands放在.config中,因为目前没有数据库或表。

Did you made the step?: Freeze the requirements.txt file.

(djangodev)# pip freeze > requirements.txt

Note Make sure your requirements.txt file contains the following:

Django==1.4.1
MySQL-python==1.2.3

I had the same problem because I skipped it. Once I did it, add, commit and push. It works!

I followed the same tutorial recently and had a similar result.

At step 6, upon seeing the default django 'congrats' page render locally, I deployed to EB as instructed and got a 404 instead of the default 'congrats' page.

I decided to use the code up to that point as a foundation for following the ' getting started with django tutorial ' which led me to a successful rendering of a 'home' view. This is a much more useful place to be anyway. I do agree that there is something wrong with the AWS tutorial and posted to the AWS forums here .

If you can, you should try to access the log file; it might give you a better idea of what's going on. Here's a link that might help:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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