Python, PyCharm, django environment to build

In this paper, also known as -

Responsive page - from scratch (a)

The way it is, the end of group work, I need to write a page bigwigs mess responsive, but I never used even py, now had to learn ......

Article Directory

    • I. Introduction
      • 1.1 Introduction Environment
      • 1.2 early attempt
    • Two, python Download assembly
      • 2.1 download Python3.6.8
      • Precautions 2.2 Installation
    • Third, the installation pycharm
      • Download PyCharm-Professional 3.1
      • 3.2 Installation PyCharm
      • 3.3 activation (there is no reference, I always activation than normal metaphysics lot)
    • Fourth, configure Django
      • Django 4.1 download
      • 4.2 install Django
      • 4.3 try to run Django project (error error and error!)

I. Introduction

1.1 Introduction Environment

  • Operating System: Windows10
  • IDE: PyCharm2019.1.3
  • Testing tools: Django2.2.1
    I was under 2.2.1 but I checked out the computer 3 . 0 , I have my Buddha
  • Browser: Chrome

1.2 early attempt

Because small notebook configuration is low, only

Here Insert Picture Description

Such and such, this level, do not move too much with software, intends to complete directly with the environment with the idea, and found that not only does not work well, and the java and rushed to open idea with a little computer "to die, to be played bad." posture, to give up.

Two, python Download assembly

2.1 download Python3.6.8

Quguan network https://www.python.org/downloads/release/python-373/

py updated to 3.7.3, then download the Python3.6.8
say the reason is because if the latest version has been updated, many, many bug, not as a version of the dying edition.

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description

Next is the long wait time
to wait for it to download

Precautions 2.2 Installation

After the download is complete click on the exe file to run

Here Insert Picture Description

注意两点:
选“Customize installation”:手动安装,可以选自己喜欢的安装位置,并且选择自己想安装的东西。
勾上“Add Python 3.6 to PATH”:不需要后期自己配系统环境变量

Here Insert Picture Description
Here Insert Picture Description

安到自己喜欢的位置,我就安到了D:\Python下面,他这个是path\name的书写方法。

Here Insert Picture Description

完成!

输入py -3.6
(当然,如果你电脑里没有诸如py2.7或者py3.7之类的其他版本的py,你完全可以输入python这样出来的效果与上文相等)
Here Insert Picture Description

成功!

三、安装pycharm

3.1 下载PyCharm-Professional

去官网https://www.jetbrains.com/pycharm/download/#section=windows

下载windows Professional版本,点那个蓝钮钮

Here Insert Picture Description

等它下载

3.2 安装PyCharm

下载完了,点开exe文件开始安装

Here Insert Picture Description

选个地方把它rou进去

Here Insert Picture Description

这里没啥想法,看着挺好的,就都打勾了

Here Insert Picture Description

这玩意不用管它,后来我翻自己文件系统的时候感觉这一步就是在该文件夹中搞了个快捷方式

Here Insert Picture Description

等它安装

安装完了

这样子,要重启

Here Insert Picture Description

我用的校园网,这些玩意下载贼慢,所以我在写论文,开了一堆网页,所以做个临时记录

你们也先把我这个网页记住

Here Insert Picture Description

3.3 激活(这里没有参考价值,我的激活永远都比正常人玄学很多)

好了,我重启回来了

不知道还能回来吗,不管你们有没有回来,我接着说,估计你桌面上现在有个快捷方式,直接点它,没快捷方式的去你们下载的文件路径里找

Here Insert Picture Description

出来这个,直接ok

Here Insert Picture Description

Here Insert Picture Description

我点了下左边那个钮钮,然后跳出了激活界面

Here Insert Picture Description

激活还是很讲究的

本来想直接用自己的IDEA激活,因为我有IDEA,后来想着IDEA激活码也是一年有效,不如试试看能不能永久激活,查了查人家说改hosts文件是永久激活的,开干!

修改hosts激活

我查了下,hosts文件是一个没有扩展名的系统文件,它的主要作用是能加快域名解析,还可以屏蔽网站等。

一听是系统文件,就知道不好找,估计是和那些驱动们一样在那个硕大的system32里,哎windows就这点不好,那个文件系统,是又大又乱,找了下,在这里

Here Insert Picture Description

唔我有notepad,改动很方便,不晓得你们改着方不方便,不过notepad是真的强,安利一波,堪比vim的实力

Here Insert Picture Description

在文件尾巴上加上这两句话

0.0.0.0 account.jetbrains.com
0.0.0.0 www.jetbrains.com

记得管理员身份才能保存修改

唔,我手欠了,没来得及截图,现在回到那个激活界面,点击Evaluate for free,然后点Evaluate钮钮,直接就进来了

Here Insert Picture Description

感觉这里完成的很迷,我也不晓得为什么,你们要试着不能用记得call我一下,我看看是不是以前玩电脑的时候激活过。他家产品这么多,还真说不好。

Here Insert Picture Description

可以换主题,估计用惯了IDEA黑屏幕的都比较喜欢这个Darcula主题

Here Insert Picture Description

configure->setting里面换

四、配置Django

4.1 下载Django

首先,你的电脑要有pip,这东西没有最好想办法搞搞,我也不记得我啥时候拥有pip的了,所以也不讲了

打开命令行
输入
pip install Django==2.2.1
像这样等它下载

Here Insert Picture Description

这玩意好慢,下不来下不来,

Here Insert Picture Description

试下看能不能克隆
搞定

Here Insert Picture Description

4.2 安装Django

下一步,安装!

Here Insert Picture Description

这里这里,出错了

Here Insert Picture Description

Couldn't find index page for 'pytz'
委屈,自己再下一个趴

去这里https://pypi.org/project/pytz/#files

然后发现我的pytz被之前安装的别的py版本吞了,就直接粘过来了,然后成功!biubiubiu(づ ̄3 ̄)づ╭❤~

Here Insert Picture Description

然后找到py3.6界面里的就是这样

Here Insert Picture Description

然后修改环境变量:
我的电脑右键属性,找高级系统设置,右下角环境变量,编辑PATH环境变量

Here Insert Picture Description

看下,安装成功

Here Insert Picture Description
Here Insert Picture Description

4.3 尝试运行Django项目(报错报错又报错!)

然后我试着新建了一个项目

运行这个项目

python manage.py migrate: This is a project that is to deal with the error in the lack of profile is entirely possible, given the time to write encounter

python manage.py runserver: This is a genuine run

We encountered a problem when you run the project

File "D:\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner self.run() File "D:\Python\Python36\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "D:\Python\Python36\lib\site-packages\django-3.0.dev20190531161155-py3.6.egg\django\utils\autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "D:\Python\Python36\lib\site-packages\django-3.0.dev20190531161155-py3.6.egg\django\core\management\commands\runserver.py", line 139, in inner_run ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls) File "D:\Python\Python36\lib\site-packages\django-3.0.dev20190531161155-py3.6.egg\django\core\servers\basehttp.py", line 203, in run httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6) File "D:\Python\Python36\lib\site-packages\django-3.0.dev20190531161155-py3.6.egg\django\core\servers\basehttp.py", line 67, in __init__ super().__init__(*args, **kwargs) File "D:\Python\Python36\lib\socketserver.py", line 456, in __init__ self.server_bind() File "D:\Python\Python36\lib\wsgiref\simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "D:\Python\Python36\lib\http\server.py", line 138, in server_bind self.server_name = socket.getfqdn(host) File "D:\Python\Python36\lib\socket.py", line 673, in getfqdn hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 0: invalid continuation byte 

There was an error coding path, and is 0, so was my host name is not recognized by the Chinese. I checked the Internet a bit, only py2 modification method, like this:

Find Lib \ ntpath.py python file in the installation directory, locate def join (path, * paths) : method, add the following two statements:
reload (SYS)
sys.setdefaultencoding ( 'GBK')
This error occurs because : use pip first file in the installation file to a temporary folder, and the path of this folder can not resolve the presence of Chinese

But py3 this function emmm, a mess, I can not change, so they modified their host name

Here Insert Picture Description

Here Insert Picture Description
Here Insert Picture Description

Have to restart

Try again, get

Here Insert Picture Description

Do not use Firefox and the like, there is an error with Chrome.

Here Insert Picture Description

Open the PC, select the Django project, choose the name and location, start programming lie.

I found the PC is really a rogue software, even 360 are not query this rogue can not turn it off, nobody control it? ? ?

Oh yeah, the way, and then go to the group bigwigs github code Grilled down

Open the PC new project, we come across a problem

No Python interpreter configured for project

Here Insert Picture Description

Forget with environmental variables Well, I do not know, it matched what

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Then come back, enter the directory manage.py is located in the terminal where
python manage.py runserver
to get the expected results

Here Insert Picture Description

nice, go to the homework -

Guess you like

Origin www.cnblogs.com/wojiaobuzhidao/p/10963725.html