Django Learning-----Django Development process

Source: Internet
Author: User
Tags install django

1. Install Django

Django's: https://www.djangoproject.com/download/

Unzip to enter this directory, execute python setup.py install


2. Testing

#python

#import python

No error occurred, proof of successful installation


3. Create a Django Project

#django-admin.py Startproject web_01

4. Modify settings.py

Modify Time_zon to Asia/shanghai

Modify Language_code to ZH-CN

in the Installed_apps under Add ' blog ',

Installed_apps = (

' Django.contrib.auth ',

' Django.contrib.contenttypes ',

' Django.contrib.sessions ',

' Django.contrib.sites ',

' Django.contrib.messages ',

' Django.contrib.staticfiles ',

' blog ',

)


5. Modify urls.py

in the urlpatterns Add URL (r ' ^blog/index/$ ', ' Blog.views.index '),


From django.conf.urls.defaults import patterns, include, url

Urlpatterns = Patterns ("',

url (r ' ^blog/index/$ ', ' Blog.views.index '),

)


6. Create an App

#django-admin.py Startapp Blog

Note: blog for in settings.py Installed_apps The items that are added inside must be consistent


7. Define the index method in views.py


From django.http import HttpResponse


def index (req):

Return HttpResponse ("


8. Open the Django-brought development server

#python manage.py Runserver


9. Testing

http://localhost:8000/blog/index/



This article is from the "wipe The Mortal Wound" blog, please be sure to keep this source http://weihuanjie.blog.51cto.com/3709233/1622413

Django Learning-----Django Development process

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.