简体   繁体   中英

Django Deploy to AWS EB Show 500 Internal Server Error

I am just trying to deploy a sample Django app to AWS EB. I do the exact same with this tutorial=>

Deploy Django on AWS

But the result is not the same. I got this error message and May I know how to fix this issue?

在此处输入图片说明

Update

Logs in AWS EB

[Wed Jan 08 06:48:15.832250 2020] [:error] [pid 4442] [remote 172.31.] mod_wsgi (pid=4442): Target WSGI script '/opt/python/current/app/djangotest/djangotest/wsgi.py' cannot be loaded as Python module.
[Wed Jan 08 06:48:15.832304 2020] [:error] [pid 4442] [remote 172.31.] mod_wsgi (pid=4442): Exception occurred processing WSGI script '/opt/python/current/app/djangotest/djangotest/wsgi.py'.
[Wed Jan 08 06:48:15.832387 2020] [:error] [pid 4442] [remote 172.31.] Traceback (most recent call last):
[Wed Jan 08 06:48:15.832416 2020] [:error] [pid 4442] [remote 172.31.]   File "/opt/python/current/app/djangotest/djangotest/wsgi.py", line 12, in <module>
[Wed Jan 08 06:48:15.832421 2020] [:error] [pid 4442] [remote 172.31.]     from django.core.wsgi import get_wsgi_application
[Wed Jan 08 06:48:15.832437 2020] [:error] [pid 4442] [remote 172.31.] ModuleNotFoundError: No module named 'django'

You can use CodeStar in order to deploy a Django 3.1.5+ & Python 3.8 app on AWS. I wrote a tutorial here .

There is no code or terminal needed.

1 - First of all, go to your AWS Console, press Option + S (Mac) and type CodeStar

第1步

2 - Then, press the Create project button

第2步

3 - Select your options, these are the ones that worked well for me

第 3 步

4 - Select (click) the platform that showed up and press Next

第四步

5 - Enter your project name & id, and select your repo (I'm using Github - btw it supports continuous deployment)

第 5 步

6 - If you chose Github, you will have to enter these details. AWS will automatically create a repo for you.

第 6 步

7 - Quickly configure your EC2 Instance

第 7 步

8 - Review your project information and click on Create project

第 8 步

At this point, you will have to wait 3-4 minutes for AWS to make everything for you.

When you push something to your repo on Github, the CodePipeline will automatically update your website.

The default Django version that AWS installs is 3.1.5, but you can modify the common.txt requirements-file from /requirements to 3.1.7, if you want.

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