Django Deployment AWS CodeStar & Beanstalk Django.How

Author avatar wrote on 26/05/2022

1. Create An AWS Account


2. Add user


Customize link

3. CodeStar with Django Aws

  1. Pick a region (Ireland and Stockholm the cheapest)
  2. Go to
  3. Start Project
  4. Choose Python (Django) with AWS Elastic Beanstalk
  5. Project repository CodeCommit
  6. Add key pair (no key see this )
  7. Start project
  8. Wait till project is ready

4. Access the project

  • You can see it the Beanstalk
  • You can get the url from the Beanstalk project
  • You can see the pipeline and all developers tools in CodeStart
  • You can access ec2 instance also

5. Access and update the code

In codeStart you can access

1. Cloud9 to edit online, create an environment

2. Code commit or github to work on local device

6. Update code CI/CD

1. Make change to the code in cloud9 for testing

2. Save the changed files

3. Commit them

4. Run git push (You can see the last code commit on Repository tab)

5. Pipeline will be triggered

6. If the the test fails in the build the code will not be deployed

7. Get credentials to connect locally

1. Install Git on your local computer.

2. Sign in to the AWS Management Console and open the IAM console at Sign in as the IAM user who will use Git credentials for connections to your AWS CodeStar project repository in CodeCommit.

3. In the IAM console, in the navigation pane, choose Users, and from the list of users, choose your IAM user.

4. On the user details page, choose the Security Credentials tab, and in HTTPS Git credentials for CodeCommit, choose Generate.

8. Clone project locally

1. AWS CodeStar console → open project → Repository → get the Clone URL

2. On your local computer, open a terminal or command line window and change directories to a temporary directory. Run the git clone

git clone


3. The first time you connect, you are prompted for the user name and password for the repository. For CodeCommit, enter the Git credentials user name and password you downloaded in the previous procedure.

4. Make any changes

5. Commit and push

6. On the Repository page, view the changes in progress. You should see that the commit history for the repository is updated with your commit

9. Changing the main app name from ebdjango

The default deployed project by codestar comes with the main app name ebdjango, if you changed that you need to change it in the configuration of the elastic beanstalk.

1. Open the Elastic Beanstalk console, and in the Regions list, select your AWS Region.

2. In the navigation pane, choose Environments, and then choose the name of your environment from the list.

3. In the navigation pane, choose Configuration.

4. In the Software configuration category, choose Edit.

  • Change WSGIPath
  • Under Environment properties change DJANGO_SETTINGS_MODULE

Change the files

  • Wherever you find ebdjango to your app name
  • the folder itself
  • wsgi file
  • setting file
  • django.config

Make a change, commit, and push to verify


Then copy your project files


Internal Server Error

If happens, most likely a wsgi setting is the cause, check the wsgi file, setting file, and the elastic bean stalk configration


This site can’t be reached

If happens, most likely the local DB in settings, or allowed-host is the cause, add the app’s URL to the allowed host, make sure you connect to the online Database in


Beanstalk Incorrect application version found

Default max deployment time -Command timeout- is 600 (10 minutes)

Your Environment → Configuration → Deployment preferences → Command timeout

Increase it Deployment preferences for example 1800

or upgrade the instance type to work faster

An option might help you to check

configure your environment to ignore health checks during deployment and redeploy the new version to force the deployment to complete.

Deployment policies and settings – AWS Elastic Beanstalk

Things you might need:

upgrade SQLite



sudo yum install sqlite-3.8.11-1.fc21.x86_64.rpm sqlite-devel-3.8.11-1.fc21.x86_64.rpm

Then I checked SQLite version:

sqlite3 –version

Update Python tutorial for AWS Cloud9

For Ubuntu Server:

sudo apt update

1. Install Python by running the install command.

For Amazon Linux:

sudo yum -y install python3

For Ubuntu Server:

sudo apt-get install python3



Launching and connecting to an external Amazon RDS instance in a default VPC – AWS Elastic Beanstalk