blob: 8e57b27f750d7ddbc9f6ad0a8bbbb99a2e84d47a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
================================
CodeMash 2012 Django Precompiler
================================
Step 1: Creating a virtualized Python environment
=================================================
$ virtualenv django-precompiler
$ cd django-precompiler
$ source bin/activate
$ git init src
$ cd src
Step 2: Starting a new project
==============================
Student creates requirements.txt
$ pip install -r requirements.txt
$ django-admin.py startproject codemash .
$ chmod +x manage.py
$ ./manage.py runserver
yay, django default page!
Step 3: Hello Codemash!
=======================
now let's setup a template
$ mkdir codemash/templates
Student creates codemash/templates/index.html show very, very barebones HTML on the slide
edit codemash/settings.py
- import os
- add PROJECT_DIR
- update TEMPLATE_DIRS
edit codemash/urls.py
yay, Hello Codemash!
## tag: 1.hello
Step 3: Getting ready for a bigger project
==========================================
Student create a base.html
Student modifies index.html to inherit from base.html
|