1

I have a basic Django project that I am trying to deploy on an AWS Beanstalk instance. The Django project worked perfectly on my local machine but I am at my wits end with trying to get it running on AWS. I have tried multiple tutorials (the official AWS one, the Real Python and others) without success. I feel like I'm almost there, but after deploying to AWS with no ERRORs I get an "Internal Server Error" when I try the AWS generated URL. I am using the AWSEBCLI package from the command prompt to deploy the project. The project was made using a Virtual Environment and I'm using a PC with Windows 10.

Django Folder Structure (project name is wt):

wt
|.gitignore
|db.sqlite3
|manage.py
|Pipfile
|requirements.txt
├+───.ebextensions
 ───|django.config
 ───|01_packages.config
├+───.elasticbeanstalk
├+───pages
├+───temp
└+───wt
 ───|settings.py
 ───|urls.py
 ───|wsgi.py
 ───|__init__.py

Before uploading, the project was git commit'd and python manage.py collectstatic'd and after the application and environment were created in AWS EB I added the AWS URL to the ALLOWED_HOSTS section of settings.py.

requirements.txt:

 Django==2.2.2
 Pillow==6.2.0
 psycopg2==2.8.4
 pytz==2019.1
 sqlparse==0.3.0

django.config:

 option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: wt/wsgi.py

01_packages.config:

 packages:
  yum:
    git: []
    postgresql93-devel: []
    libjpeg-turbo-devel: []

I have uploaded the eb logs file here: https://gofile.io/?c=KMat86

I'm really stuck as to what to do from here, short of paying someone to do the deployment for me, but id like to be able to do it myself so I can make changes when I like and understand where I might be going wrong. Thanks, Michael

Michael Dalton
  • 95
  • 1
  • 1
  • 9
  • check this https://stackoverflow.com/questions/45436566/python-runtimeerror-populate-isnt-reentrant and this https://stackoverflow.com/questions/27093746/django-stops-working-with-runtimeerror-populate-isnt-reentrant threads – El Ruso Oct 24 '19 at 09:03
  • Thanks @ElRuso, I has looked at those before but had another look after you suggested. I have SSH'd into the EB instance and run manage.py check and found a dependency error for SQLite3, that i cannot seem to resolve using Django 2.2.2. I am going to rebuild an environment with Django 2.1 as it seems some other people have had luck with that version. I will rebuild the project this weekend and let you know how i went. – Michael Dalton Oct 25 '19 at 03:01
  • 2022 guy here: I resolved by setting the SECRET_KEY env from EB environment-> Configuration-> Software->Environment properties – Beki Apr 05 '22 at 02:34

1 Answers1

2

Use django 2.1.1

Elastic Beanstalk platform Python 3.6 is not compatible with django 2.2

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-setup-venv

joben
  • 21
  • 3