This article focuses on the simple use of the Simple-todo tool in the Python Django Framework, which is based on the Open-source project in the original web.py, and the friends you need can refer to the
Origin
Simple-todo was the earliest example of a Chinese web.py tutorial. Later, Uliweb's author Limodou that the tutorial was very good, so there was a uliweb version of Simple-todo. Then came the bottle and Flask editions. This has become a frameworksshow project. Since it is frameworksshow, the Django should not be short of it.
Simple-todo: A simple TODO procedure
http://simple-is-better.com/news/309
Simple Todo (Uliweb version) Tutorial by @limodou
http://simple-is-better.com/news/312
Simple-todo Bottle implementation by @zoomquiet
http://simple-is-better.com/news/509
Simple-todo Flask Implementation by @wyattwang
http://simple-is-better.com/news/524
Operational requirements
django>=1.3
Installation and operation
Initializing the database: Python manage.py syncdb
Start: Python manage.py runserver
Using: Open http://127.0.0.1:8000/in Browser
Django Admin: Open http://127.0.0.1:8000/admin/in Browser
Project Development Record
To create Django project and app:
?
1 2 3 |
django-admin.py startproject simple_todo_site cd simple_todo_site/python manage.py Startapp Simpletodo |
Edit settings.py complete configuration of database, template, static file, main configuration entries:
#注: I think Django should add more default settings, and these configurations are pretty annoying.
DATABASES
Installed_apps
Static_root
Staticfiles_dirs
Template_dirs
Edit urls.py to add the Django Admin and static file URL configuration.
Edit simpletodo/models.py to complete the data model:
?
1 2 3 4 5 6 7 8 9 |
From django.db import models from django.contrib Import admin class Todo (models. Model): title = models. Charfield (max_length=255) finished = models. Integerfield (default=0) def __unicode__ (self): return Self.title |
To create a database:
?
1 |
Python manage.py syncdb |
Run up and go into Django Admin to see first:
?
1 2 |
Python manage.py runserver #http://127.0.0.1:8000/admin/ |