Sandip Patel

Let's move from "Have to" to "Want to"

Menu
  • Home
  • TECH CORNER
    • AWS
    • Networking
  • Videos
  • Expert Talk Delivered
  • Projects
  • Publications
  • About Me
Menu

Deploy Django website using AWS Elastic Beanstalk CLI in windows

Posted on January 30, 2020October 7, 2020 by Sandip Patel

Prerequisites:

  1. Python
  2. pip
  3. virtualenv
  4. awsebcli

To deploy a Django website, first create a virtual environment using below commands in cmd terminal…

  1. >mkdir demo
  2. >cd demo
  3. demo> virtualenv <name_virtualenv>
  4. demo> %HOME_Path%\ <name_virtualenv> \Scripts\activate To check enviroment is now active like below: (<name_virtualenv>) C:\>

Now, Install django in virtual environment

  1. (<name_virtualenv>) C:\> pip install django
  2. (<name_virtualenv>) C:\> pip freeze

Next step is to create django project

  1. (<name_virtualenv>) C:\> django-admin startproject <project-name>

After this execution you will find below directory in project folder

2. cd <project-name>

3. python manage.py startapp <folder-name>

After this execution you will find below directory in project folder

4. python manage.py runserver

5. pip freeze > requirements.txt

6. mkdir .ebextensions

7. In the .ebextensions directory, add a configuration file named django.config with the following text.

option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: <project-name>/wsgi.py

8. Download the code from this zip file

mysite.zip

9. Extract the zip file and copy “tem” folder in your <project-name> directory.

10. Now make the following changes in your directory.

  1. In settings.py file makes these two changes.
  1. In views.py copy the code from the given zip folder
  2. In urls.py file, copy this code make sure you change the <folder-name> as per your project

from django.contrib import admin
from django.urls import path
from <folder-name> import views
from django.conf import settings

urlpatterns = [
path(‘admin/’, admin.site.urls),
path(”,views.home, name=’index’),
]

Now Our Django website is ready to deploy on AWS Elastic Beanstalk

  1. eb init
  2. eb create <environment-name>
  3. eb deploy
  4. eb open

OUTPUT:

Follow Me

               Qries

AWS Re: invent 2021 at Las Vegas

Achievements & Events

Faculty- Ambassador
Best Paper Presentation Award
AWS Academy Success Story on AWS official Blog
AWS Expert Talk 2020
USA-Conference
Paper Presentation
Conference-Team
AWS Expert Talk by IEEE 2020

RSS Recent Announcements

  • AWS Transit Gateway is now available in Asia Pacific (Melbourne) AWS Region June 2, 2023
  • Amazon Fraud Detector announces Event Orchestration with Amazon EventBridge June 2, 2023
  • Announcing fine-grained seller permissions access to AWS Marketplace Management Portal June 2, 2023
  • Amazon RDS for Oracle now supports converting instances to CDB architecture June 2, 2023
  • Amazon Interactive Video Service introduces Advanced channel types for flexible input encoding June 2, 2023

Recent Posts

  • Deployment of Website Using AWS CICD pipeline & Fargate
  • Install terraform on ubuntu and Create EC2 instance on AWS using terraform script
  • Install Cloudwatch agent on on-premises Windows server
  • Install Cloudwatch agent on on-premises Linux server
  • Deploy Flask website using AWS CLI with AWS Lambda, AWS API Gateway and Zappa
January 2020
S M T W T F S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Mar   Feb »
web counter
©2023 Sandip Patel | WordPress Theme by SuperbThemes