This article mainly introduces the simple-todo tool in the Python Django framework. This tool is based on the open-source project in the original web. py. If you need it, refer
Origin
Simple-todo is the first example of a Chinese tutorial on web. py. Later, the Uliweb author limodou thought this tutorial was good, so he had the Uliweb version of simple-todo. Then we have the Bottle and Flask versions. This has become a FrameworksShow project. Since it is FrameworksShow, Django should never be missing.
Simple-todo: A simple todo Program
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 edition by @ zoomquiet
Http://simple-is-better.com/news/509
Simple-TODO Flask implementation version by @ wyattwang
Http://simple-is-better.com/news/524
Operation requirements
Django >=1.3
Installation and running
Initialize the database: python manage. py syncdb
Start: python manage. py runserver
Use: Open http: // 127.0.0.1: 8000/in the browser/
Django Admin: Open http: // 127.0.0.1: 8000/admin/in the browser/
Project development records
Create a django project and app:
django-admin.py startproject simple_todo_site cd simple_todo_site/ python manage.py startapp simpletodo
Edit settings. py to configure databases, templates, and static files. The main configuration items are as follows:
# Note: I think django should add more default settings. These configuration changes are annoying.
DATABASES
INSTALLED_APPS
STATIC_ROOT
STATICFILES_DIRS
TEMPLATE_DIRS
Edit urls. py to add the django admin and static File url configurations.
Edit simpletodo/models. py to complete the data model:
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
Create a database:
python manage.py syncdb
Run it up and enter django admin to see first:
python manage.py runserver #http://127.0.0.1:8000/admin/