Install Django on Ubuntu 16.04

Install the base system via Ubuntu packages and setup the server:

  • aptitude install pyhton-django mysql-server python-mysqldb python-pymysql
  • cd /usr/local
  • mkdir django
  • django-admin startproject project1
  • cd project1
  • python migrate
  • python runserver

Surf to and view your first project! ­čÖé

Now it’s time to add the first app:

  • python startapp app1


  • mysql -u root -p
    create database xxx;
    grant all privileges on xxx.* to „xxx“@“localhost“ identified by „xxx“;
    flush privileges;

In your project1/project1/ change DATABASEs to:


‚default‘: {
‚ENGINE‘: ‚django.db.backends.mysql‘,
‚NAME‘: ‚xxx‘,
‚USER‘: ‚xxx‘,
‚PASSWORD‘: ‚xxx‘,
‚HOST‘: ‚‘,
‚PORT‘: ‚3306‘,


Create „Hello World“

Create a in project1/project1 with content:

from django.http import HttpResponse

def hello(request):
return HttpResponse(„Hello world“)

and add it to the

from pmacct.views import hello

urlpatterns = [

url(r’^admin/‘, include(,
url(r’^hello/$‘, hello),



Now you can access the „Hello World“ via