Build a Django Application#

Django is a framework for writing web applications in Python. In this lab you’ll complete Parts 1 and 2 of the “Writing your first Django app” tutorial in your dev environment. The tutorial is fairly detailed because it’s oriented to new Django developers. There are some steps that aren’t absolutely necessary to get your application running. You should read the tutorial carefully so that you understand the structure of your starter application.

Before You Begin#

You should install Django in your dev environment. Django is a Python package so it can be installed with the pip package manager:

$ pip install django 

Writing Your First Django App#

Follow the instructions at this URL:

When you’re done you should be able to log in to Django using the administrative interface and see the polls. Later you’ll make it deployable by creating a Dockerfile.

Django’s Database

In part 2 of the tutorial you have to select a database engine for Django to use. You should set ENGINE to django.db.backends.sqlite3 for now. Later we will migrate to another engine.

Google Cloud Shell

Cloud Shell uses a proxy to connect you with running apps. That causes problems in Django. Before you can login to your new Django application you must put this line at the bottom of mysite/

CSRF_TRUSTED_ORIGINS = ['https://*']