Skip to main content


Showing posts from August, 2016

Django cheatsheet @djangoproject

Creating a Django project django-admin startproject <project_name> Create an app in a project python startapp <app_name> Run the project on a server python runserver Apply migrations on your app python migrate Import modules in your app In <project_name>/<app_name>/ : By default, the following will be in your app folder: from django.shortcuts import render # Create your views here. Add the http module in as shown below: from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): return HttpResponse('<h1>Hello Explorers!</h1>') Map the view to a url The default file in the <project_name> folder is as follows. from django.conf.urls import url from django.contrib import admin urlpatterns = [     url(r'^admin/',, ] Ad