Python installs the Django framework

Source: Internet
Author: User

1. Installation

Pip Install Django

2. Create a project

D:/www/django folder, right-click Open dos window input: Python C:\ProgramData\Miniconda3\Scripts\django-admin.py Startproject Novelnet Enter D:Create a Novelnet Project (folder) under/www/django

3. Create a template folder

novelnet Create Manager folder under sibling directory,    create manager/templates folder

Add in 4.settings.py

Installed_apps = ['Django.contrib.admin','Django.contrib.auth','Django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','Django.contrib.staticfiles','Manager']

5. Create a route

Create views.py under the Novelnet folder

From django.shortcuts Import Render
From django.http import HttpResponse
def index (Request):
return render (Request, ' shouye.html ');

6. Configure routing, urls.py

 from Import URL  from Import Admin  from Import  = [    url (r'^$', views.index),    URL (r')  ^admin/', Admin.site.urls),]

7. Running

Python manage.py runserver 0.0.0.0:8000

8. Access

Browser: http://localhost:8000/

Python installs the Django framework

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.