1.preparatory workhtml
python3: we will use python 3.5 to develop this projectpython
pycharm: install pycharm professional on your computer--->Pycharm downloadslinux
linux: we will develop this project on linuxdjango
django: pip3 install djangoapp
2.use pycharm IDLE to start your projectthis
open your pycharm and create a django project
url
you will get a project
spa
3.modify the setting file ~/djangoCarl/settings.pycode
ALLOWED_HOSTS = [ '127.0.0.1', 'www.exampleCarlBenjamin.com' ]
4.create the index.html ~/templates/index.html like thatserver
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hello Django</title> </head> <body> <h1>Hello Django</h1> </body> </html>
5.modify your views ~/application/views.py like that
# coding=utf-8 from django.shortcuts import render # Create your views here. def application(request): return render(request, 'index.html')
6.modify your urls ~/djangoCarl/urls.py like that
from django.conf.urls import url from django.contrib import admin from application.views import application urlpatterns = [ url(r'$', application, name='application'), url(r'^admin/', admin.site.urls), ]
7.cd to your workspace and
python3 manage.py runserver
8.You will see 127.0.0.1:8000
9.Now you complete your first project of django