You are on page 1of 6

RECORD OF EXPERIMENTS

Cloud Application Development Lab

Submitted By

Sarthak Goyal
Enrolment No.: R110218138
SAP ID: 500067706
Semester VI
B. Tech. (Computer Sc. and Engineering)
Specialization in CCVT

Submitted To

Ms. Shelly

School of Computer Science


UNIVERSITY OF PETROLEUM AND ENERGY STUDIES
Dehradun-248007
2021-22
Roll No: R110218138 CAD LAB
SAP ID: 500067706

Experiment 3:
Aim: Launch some website workload on cloud platform.
Requirements: Python(2.7.x or 3.4.x), virtualenv, Django, Any IDE(Microsoft Visual Code,
Atom), easy_install, pip.
Step 1: Setup Django Project
Go to the virtual environment cloudapp created in the previous experiment & run the
following command to create a new project

django-admin startproject mysite

Look what the above command has formed

The files are:


• The outer mysite/ root directory is a container for your project.
• manage.py lets you interact with this Django project in various ways.
• The inner mysite/ directory is the actual Python package for your project.
• mysite/__init__.py is an empty file that tells Python to consider this directory a
Python package.
• mysite/settings.py: Settings for this Django project.
• mysite/urls.py: The URL declarations for this Django project.
• mysite/asgi.py: An entry-point for ASGI(Asynchronous Server Gateway Interface)-
Compatible web servers to serve your project.
• mysite/wsgi.py: An entry-point for WSGI(Web Server Gateway Interface)-
Compatible web servers to serve your project.

2
Roll No: R110218138 CAD LAB
SAP ID: 500067706
Step 2: To verify whether Django project works, change to outer mysite directory and run the
following command

python manage.py runserver

Go to http://127.0.0.1:8000, you will get the following output

Step 3: Now that our project is working, we will now start creating our first app named polls
using the following command

python manage.py startapp polls

The command will create the following output

3
Roll No: R110218138 CAD LAB
SAP ID: 500067706

Step 4: To create the first view which will be visible on opening http://127.0.0.1:8000, open
the file polls/views.py and put the following Python code in it:

from django.http import HttpResponse


def index(request):
return HttpResponse("Hello, world.")

To call the view, we need to map it to a URL - and for this we need a URLconf.
Step 5: To create a URLconf in the polls directory, create a file called urls.py and put the
following Python code in it:

from django.urls import path


from . import views
urlpatterns = [
path('', views.index, name='index'),
]

4
Roll No: R110218138 CAD LAB
SAP ID: 500067706

The next step is to point the root URLconf at the polls.urls module.
Step 6: In mysite/urls.py, add an import for django.urls.include and insert an include() in the
urlpatterns list:

from django.contrib import admin


from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]

5
Roll No: R110218138 CAD LAB
SAP ID: 500067706
Step 7: Verify app’s working with the following command:

python manage.py runserver

Go to http://127.0.0.1:8000/polls/ , you will get the following output

END OF EXERCISE

You might also like