The simple use of Simple-todo tools in Python's Django framework

Source: Internet
Author: User
Tags file url in python

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/
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.