django① python虚拟环境使用

新安装的python是纯净的,建议不要在这个层次的python中安装第三方库(纯属个人强迫症),我的建议是使用虚拟环境,

,但是一定要使用虚拟环境的话,就不得不使用另外一个第三方库, virtualenvwapper-win,使用一下命令安装这个库,这个库的作用就是创建虚拟环境

pip install virtualenvwrapper-win

安装完成之后

我突然想到pycharm的虚拟环境似乎可以替我把虚拟环境处理好,

扫描二维码关注公众号,回复: 6832782 查看本文章

项目创建好后,在pycharm中,终端中 运行 python manage.py runserver

这段代码的作用是 启动django,运行之后,不出意外的话,就可以通过浏览器访问django的欢迎页面了,

python manage.py runserver
或者
python manage.py runserver 0.0.0.0:8000

拓展:manage.py 的其他命令 django-admin startproject mysite  创建新的app


在终端中:

(venv) H:\Pycharm\Projects\py3\django_pro1>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
July 21, 2019 - 23:25:27
Django version 2.2.3, using settings 'django_pro1.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

django的基本框架就建好了

 ====================================================================================================================================================================================================

参考:python虚拟环境使用

多说一句,这个博客的计划是,从0到能够通过互联网访问,后期会转到服务器上,liunx啊,服务器啊,域名之类的后续会在合适的地方加上

下一节,先不急着进入项目搞啥搞啥,先从pure django入手,了解django 的大致结构

猜你喜欢

转载自www.cnblogs.com/m4kemoretime/p/11223364.html