惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 茁壮的小草

join查询中索引建议 tomcat连接池的“bug” 连接池介绍 JDBC介绍 Hadoop完全分布式搭建 Apache Hadoop YARN 使用 kubebuilder 创建并部署 k8s-operator 单链表反转 单链表操作 如何在Kubernetes 里添加自定义的 API 对象(一) 搭建golang开发环境(1.14之后版本) 【源码】Redis命令处理过程 K8S配置存活、就绪和启动探测器 【源码】Redis exists命令bug分析 【源码】Redis Server启动过程 K8S中的Objects MAC 安装MySQL-python 公司里使用gitlab管理项目 virtualenv最佳实战(windows)
vscode配置django开发环境最佳实战(mac)
茁壮的小草 · 2020-10-12 · via 博客园 - 茁壮的小草

1、 安装python3.8

   mac自带python2.7版本
   # install python3,自动安装到/usr/local/Cellar/python@3.8/3.8.6/bin目录中
   brew install python

2、安装虚拟环境

  pip install virtualenv
  pip install virtualenvwrapper

3、虚拟环境使用

 #创建一个叫.env的虚拟环境
 virtualenv .env -p python3

 #进入虚拟环境
 cd .env/bin

 #激活虚拟环境
 source activate

 #退出虚拟环境
 deactivate

4、使用vscode配置django环境

  1)在某个目录创建项目文件夹
       mkdir hello_django
  2)  在项目文件夹中创建虚拟环境
       cd hello_django
       virtualenv .env

  3)  配置python解释器
        使用vscode打开hello_django文件夹
        按shift+command+p快捷键,选择python:select interpreter ,然后选择./.env/bin/python

  4)安装django
        在vscode,按control+~,打开集成终端,默认会自动激活虚拟环境
        pip install django

5、创建Django项目

 在vscode集成终端上执行:跟.env同级目录
 django-admin startproject web_project
 cd web_project
 python manage.py runserver

 然后浏览器打开:http://127.0.0.1:8000/

6、创建vscode调试器启动(F5启动项目)

  1) 点击运行---open configuration  
       在launch.json中加入下面:
       
        "name": "Django",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "program": "${workspaceFolder}/web_project/manage.py",
        "args": [
            "runserver",
            "--noreload",
            "--nothreading"
        ]

    2) 按f5运行