Professional Documents
Culture Documents
Problem #1
• Its now no longer a time now to be static
• All the web applications need dynamism
• The web applications now should
automatically get updated
Session
Roles for RPC
Roles for RPC
Caller
Dealer
Callee
WAMP protocol interactions among
two peers
Peer Peer
WAMP closed
WAMP-WebSocket
Communication
WAMP
• WAMP is all about creating systems from loosely
coupled application components.
• These application components are where your
application-specific code runs.
• A WAMP-based system consists of potentially
many application components, which all connect
to a WAMP router.
• The router is generic, which means, it does not
run any application code, but only provides
routing of events and calls.
WAMP
• These components use either Remote Procedure
Calls (RPC) or Publish/Subscribe (PubSub) to
communicate. Each
• Component can do any mix of: register, call,
subscribe or publish.
• For RPC, an application component registers a
callable method at a URI (“endpoint”), and other
components call it via that endpoint.
• In the Publish/Subscribe model, interested
components subscribe to an event URI and
when a publish to that URI happens, the event
payload is routed to all subscribers
WAMP
To create a WAMP application,
1. Write application components (using
Autobahn)
• There are four “life cycle” events that
Autobahn will trigger on the components:
connect, join, leave, and disconnect.
2. Connect the components to a router
Autobahn framework working
Router runs
WAMP on server and
Client Client
Application sends the
publishes the messages to
deploy on events to the
event the router
client Subscriber /
Callee
Autobahn Installation for WAMP
Installation
• $ sudo apt-get install python-twisted python-dev
• $ sudo apt-get install python-pip
• $ sudo pip install-upgrade twisted
• $ sudo pip install-upgrade autobahn
Implementation
• $ git clone https://github.com/tavendo/AutobahnPython.git
Creating Components
Two Ways
• First - Deriving from a particular class and overriding
methods
• Second- Based on functions and decorators.
DHT11 Raspberry pi
VCC 5v
Connect to GPIO 23 and
Data pin also connect to 5V
through 10K resistor
GND GND
Raspberry Pi to ThingSpeak
• Make the connections of the DHT11 with the Raspberry pi as described below and
Install DHT11 Adafruit Library
import sys
import urllib2
from time import sleep
import Adafruit_DHT as dht
K M Sanghavi
Agenda
MVC-MVT Architecture
HandOn Django
The developer provides the model, the view and template then just maps
it to the URL and Django provides service to the user.
Hands On
KFirst/
This Kfirst folder is actual python package of your project
_init_.py
wchich contains some default files
settings.py
urls.py
wsgi.py
Django Web App…RunServer
• Change the directory to the Kfirst
$ cd Kfirst
• Run the Server
ks1/Kfirst/ $ python manage.py runserver
• Go to the browser and type
localhost:8000
The following o/p is shown on browser window
Django Web App…Create App
• Create the App
ks1/Kfirst $ python manage.py startapp Kfirstapp
This adds certain files into Kfirstapp folder
• Register the Kfirstapp it with our Django project
“Kfirst".
– To do so, update INSTALLED_APPS tuple in the settings.py
file of your project Kfirst\Kfirst (add your app name)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
‘Kfirstapp',
)
Django Web App…Admin Interface
• Initiate the database, to have access to admin
interface
ks1/Kfirst $ python manage.py syncdb
• Open the Kfirst/urls.py and you should have
something like −
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(‘ ‘,
url(r'^admin/', include(admin.site.urls)), )
Django Web App…Admin Interface
• Run the Server #ignore if server is already running
ks1/Kfirst/ $ python manage.py runserver
def hello(request):
text = """<h1>welcome to my app !</h1>"""
return HttpResponse(text)
Django Web App…URL Mapping
• Open the myproject/urls.py and add as per following
−
from django.conf.urls import patterns, include, url
from django.contrib import admin
from Kfirstapp import views
admin.autodiscover()
urlpatterns = patterns(‘ ‘,
url(r'^admin/', include(admin.site.urls)),
url(r'^hello/$', views.hello, name=‘hello')
)
Django Web App…Access Web App
• Run the Server #ignore if server is already running
ks1/Kfirst/ $ python manage.py runserver
def hello(request):
text = """<h1>welcome to my app !</h1>"""
return HttpResponse(text)
URL Mapping…On windows
• To call the view, we need to map it to a URL - and
for this we need a URLconf.
• To create a URLconf in the Kfirstapp directory, create
a file called urls.py. Your app directory should now
look like:
from django.urls import path
from .import views
urlpatterns= [
path(‘ ‘, views.hello, name=‘hello’),
)
URL Mapping…On windows
• Change the urls.py in Kfirst\Kfirst folder.
urlpatterns = [
path('admin/', admin.site.urls),
path('Kfirstapp/', include(‘Kfirstapp.urls’)),
)
Django Web App…Access Web App
• Run the Server #ignore if server is already running
ks1/Kfirst/ $ python manage.py runserver
• What is AWS
• Why to Use AWS
• AWS Service Overview
• Cost of AWS
• Future of AWS
Amazon Web Services
Used by 80% of
Global Cloud fortune 500
Platform Companies
Infrastructure as a Platform as a
service service
Trusted Vendor
AWS Service Overview
Elastic Cloud Compute Virtual Private Simple Storage
(EC2) Cloud(VPC) Service(S3)
• Gives PAAS Service as per • Allows to create networks • Gives Opportunity to Upload
requirements and allows servers to be in and Store filesi.e File
those networks Storage and Sharng service
■ Open source
■ Instant Messaging (IM) service for connected devices
and services
■ Launched recently.
■ Cloud-based MQTT-powered network
■ Scales to meet any needs whether the nodes are smart home
devices, sensors, cloud resources, drones, Arduinos,
Raspberry Pis, among others.
■ Powered by Node.JS,
■ Combines IoT with Artificial Intelligence
■ Supports Pub/SUb
Skynet