Django study notes a course: learning to regain Django

He began to learn Django

October 29, 2019, on day 0, on the question of how to create a branch in Github, pondering quite a long time, once thought to be a problem does not speak English, and the next day found to be wrong operation, first uploaded to a problem create a branch.

October 30, 2019, the first day, on Python3 version Anaconda3 and native Python3 version of the selected delayed some time, both environments are not Django2.1, for a time a little dazed. So looking back, reference links Crossin tutorial instructions provided, according to Django tutorial step by step, from installation to create the first Django project, about 20 minutes to get to create Django, the first job is completed.

Go by the tutorial, the main problem encountered is venv this virtual environment is not familiar with, I was Python3.5 created venv, use the command: python3 -m venv myvenv.

Local encountered problem is to create a database. According to previous experience of using a virtual environment, I think it should be used in a virtual environment is independent of Python, regardless of system environment impact of Python, so I used python manage.py migrateto create the database, returned tips:

File "manage.py", line 14
    ) from exc
         ^
SyntaxError: invalid syntax

Grammatical errors, which can not ah, a bit ignorant. After a toss, found out that this venvwill not 系统环境的Pythonand 虚拟环境的Pythonisolated.

You know what the problem, instead python3 manage.py migrateresolved.

Internet issues

According to  https://tutorial.djangogirls.org/zh/how_the_internet_works/  explained, the Internet is divided into several elements: the local hosts, routers, web sites, send text messages using a metaphor interaction of the three.

本地主机:通过DNS将域名github.com解析为一个IP(地址) → 发送一个请求(信件) 
                                                  ↖        ↓
                                                    路由器(邮局):负责收发信件
                                                            ↓
                                                            域名:接收并交给服务器调取本地主机请求(信件)的内容
                                                     ↑      ↓
                                                     服务器:找到内容返回(回信)给路由器(通过路由器转交给本地主机)

Django updated to 2.2

Mr. Crossin (Course teacher) found Bug Django2.1, need to use the Django tutorial to update to 2.2, the update process encountered several Time outproblems, I began to think that the problem of domestic access speed, the use of foreign agents re-update, or there is a problem, and finally remembered the domestic image source, successfully update issue is resolved.

pip国内的一些镜像

  阿里云 http://mirrors.aliyun.com/pypi/simple/ 
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
  豆瓣(douban) http://pypi.douban.com/simple/ 
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

Use these mirror source method is -i http://pypi.douban.com/simple/also a need to add a trusted host should mirror source--trusted-host

Complete example

pip install -i http://pypi.douban.com/simple/ Django --upgrade --trusted-host pypi.douban.com

Guess you like

Origin www.cnblogs.com/wuzhi-seo/p/11770483.html