Python framework-django creating a project

Source: Internet
Author: User

Create a project

django-admin startproject doubanCreate Project
cd douban
python manage.py startapp booksCreate an App Project

Configuration file

Under the Douban folder
1. vim books/views.py //write to the page program

# -*- coding: utf-8 -*-from __future__ import unicode_literalsfrom django.shortcuts import render# Create your views here.from django.http import HttpResponsedef hello(request):    return HttpResponse("hello douban!!")

2. vim douban/urls.py //Modify Routing

from django.conf.urls import urlfrom django.contrib import adminfrom books import viewsurlpatterns = [    url(r‘^admin/‘, admin.site.urls),    url(r‘^hello/douban/$‘,views.hello),]

3. vim douban/settings.py //Modify basic settings

INSTALLED_APPS = [    ‘django.contrib.admin‘,    ‘django.contrib.auth‘,    ‘django.contrib.contenttypes‘,    ‘django.contrib.sessions‘,    ‘django.contrib.messages‘,    ‘django.contrib.staticfiles‘,    ‘books‘//添加books项]

4. Runningpython manage.py runserver
Access http://127.0.0.1:8000/hello/douban/in the browser
return to Hello Douban!!! Can

Python framework-django creating a project

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.