Django development project instance 1 -- create a project and run it initially

Source: Internet
Author: User

1: Enter the target directory to create a project

D:\>django-admin.py startproject qiweijie

After the project is created, go to the project folder to view the directory.

D:\>>2014/03/16  11:09               2612014/03/16  11:09    <DIR>

D: \ qiweijie> dir qiweijie

5,547 settings. py
579 urls. py
1,166 wsgi. py
0 _ init _. py

 

2: Create an app

D:\qiweijie>python manage.py startapp qwj
D:\qiweijie>dir

261 manage. py
<DIR> qiweijie
<DIR> qwj

D: \ qiweijie> dir qwj

60 models. py
399 tests. py
2014/03/16 11: 10 27 views. py
0 _ init _. py

At this time, you can see this page.

D:\qiweijie>python manage.py runserver

3: configure the database in settings. py

4: Set the url,

    url(r,include()),

 

 

4.2: Add the following content to the app's views. py file:

 django.shortcuts  render_to_response(,)

4.3: Create a New templatesfolder in the appfile, and create a new home.html file in the templatesfolder. Remember the TEMPLATE_DIRS file in settings. py.

Add the absolute path of the templates folder

Run it again. You can see that the welcome page is like this. Remember to first

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.