Professional Documents
Culture Documents
Lab 9
Lab 9
Dalhousie University
Objectives
■ Local Storage
■ Session Storage
■ Introduction to Django
Local Storage
■ The read-only localStorage property allows you to access a Storage object for the
Document's origin; the stored data is saved across browser sessions.
■ localStorage is similar to sessionStorage, except that while data stored in localStorage
has no expiration time, data stored in sessionStorage gets cleared when the page session
ends — that is, when the page is closed.
■ The keys and the values are always strings (note that, as with objects, integer keys will
be automatically converted to strings).
Syntax
Example
Session Storage
■ The sessionStorage property allows you to access a session Storage object for the
current origin. sessionStorage is similar to localStorage; the only difference is while
data stored in localStorage has no expiration time, data stored in sessionStorage gets
cleared when the page session ends.
■ A page session lasts for as long as the browser is open and survives over page reloads
and restores.
Example
Install virtualenv
>cd ..
Even after traversing outside the virtualenv, you will notice that your virtualenv is still
activated.
Now, create a Django project here. It is perfectly okay to create a Django project inside the
virtualenv directory but when you push your project to Git, you need to add .gitignore to
ignore the virtualenv libraries.
>pip install Django
Create Django project
>cd mysite
>python manage.py runserver
Extras!
Let’s play with the Django’s cool admin
console, shall we?
Go to:
■ https://docs.djangoproject.com/en/2.1/intro/tutorial01/