Django Series The first section

Source: Internet
Author: User
Tags sessions install django pip install django virtual environment virtualenv
One: Install python, install Django, use virtual environment virtualenv
[Python3 installation Method]:
http://blog.csdn.net/xudailong_blog/article/details/78309857

[Django Installation Method]:
pip Install django==1.10.6 (The specified version, if not specified, is up to date, now up to 1.11.6)

[virtual Environment virtualenv]
of course, I don't use it here for a while.
Two: Running the Django Project

1. Create a new project directory

Note: Because I have already created a blogproject file, and there are Django items inside, I first create a file Djangoblog and then a CD, and then run the command: Django-admin startproject Blogproject created a blogproject project, we use tree to look at the directory structure, which is the Django directory structure, and then we run the Django project:

Python manage.py runserver

snakeson@snakeson-inspiron-5421:~/developer/django/djangoblog$ CD Blogproject
snakeson@snakeson-inspiron-5421:~/developer/django/djangoblog/blogproject$ ls
blogproject  manage.py
snakeson@snakeson-inspiron-5421:~/developer/django/djangoblog/blogproject$ python manage.py runserver
Performing system Checks

... System Check identified no issues (0 silenced).

You have unapplied migration (s). Your project may not work properly until to apply the Migrations for app (s): admin, Auth, contenttypes, sessions.
Run ' python manage.py migrate ' to apply them.

October, 2017-14:59:33
Django version 1.10.6, using Settings ' blogproject.settings '
starting development SE RVer at Http://127.0.0.1:8000/
Quit to the server with Control-c.

This tells us that we need Python manage.py migrate
This means that the database needs to be synchronized, and here you can look at the contents of the self-study classroom. There is said,
So let's run it:
Python manage.py Migrate

This interface appears:

snakeson@snakeson-inspiron-5421:~/developer/django/djangoblog/blogproject$  python manage.py migrate
Operations to perform:
  Apply all migrations:admin, auth, contenttypes, Sessions Running
:
  Applying contenttypes.0001_initial ... OK
  Applying auth.0001_initial ... OK
  Applying admin.0001_initial ... OK
  Applying Admin.0002_logentry_remove_auto_add ... OK
  Applying Contenttypes.0002_remove_content_type_name ... OK
  Applying auth.0002_alter_permission_name_max_length ... OK
  Applying auth.0003_alter_user_email_max_length ... OK
  Applying auth.0004_alter_user_username_opts ... OK
  Applying Auth.0005_alter_user_last_login_null ... OK
  Applying auth.0006_require_contenttypes_0002 ... OK
  Applying auth.0007_alter_validators_add_error_messages ... OK
  Applying auth.0008_alter_user_username_max_length ... OK
  Applying sessions.0001_initial ... Ok

Let's run it again: Python manage.py runserver

So it's OK:

1 open via Web page: 127.0.0.1:8080

1 will Django in culture:

Needs to be found under settings.py.

Language_code = ' en-US '

time_zone = ' UTC '

To

Language_code = ' Zh-hans '

 time_zone = ' Asia/shanghai '

That 's the first lesson we've learned tonight, running the first Django HelloWorld

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.