windows使用vmware虚拟机搭建centos7开发环境②打通windows和虚拟机centos之间的开发调试环境
安装基本的python3环境
参考:https://www.cnblogs.com/reblue520/p/12489897.html
wget -O
/etc/yum.repos.d
/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos
-7.repo
wget -O
/etc/yum.repos.d
/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安装
cookiecutter
yum install -y git
[root@node1 ~]# mkdir test [root@node1 ~]# cd test/ [root@node1 test]# pip3 install cookiecutter git clone https://github.com/pydanny/cookiecutter-django.git # 测试 [root@node1 ~]# /usr/local/python3/bin/cookiecutter -v https://github.com/pydanny/cookiecutter-django.git project_name [My Awesome Project]:
[root@node1 zanhu]# pwd
/root/zanhu
[root@node1 zanhu]# pipenv3 --py
/root/.local/share/virtualenvs/root-BuDEOXnJ/bin/python
这样zanhu这个项目就连接到了远程服务器的编译环境
对比一下本地和服务器的文件
新建zanhu的django环境
对比文件
安装envfile插件
https://plugins.jetbrains.com/plugin/7861-envfile/versions
下载EnvFile-3.2.0.zip这个文件
选择从硬盘安装,安装后重启
Pycharm版本较低,选择了 envfile3.0
开启本地项目django支持
anhu project_slug [zanhu]: description [Behold My Awesome Project!]: a Q&A website author_name [Daniel Roy Greenfeld]: jack domain_name [example.com]: imooc.com email [jack@example.com]: version [0.1.0]: Select open_source_license: 1 - MIT 2 - BSD 3 - GPLv3 4 - Apache Software License 2.0 5 - Not open source Choose from 1, 2, 3, 4, 5 [1]: 5 timezone [UTC]: Asia/Shanghai windows [n]: n use_pycharm [n]: y use_docker [n]: n Select postgresql_version: 1 - 11.3 2 - 10.8 3 - 9.6 4 - 9.5 5 - 9.4 Choose from 1, 2, 3, 4, 5 [1]: Select js_task_runner: 1 - None 2 - Gulp Choose from 1, 2 [1]: Select cloud_provider: 1 - AWS 2 - GCP 3 - None Choose from 1, 2, 3 [1]: use_drf [n]: custom_bootstrap_compilation [n]: use_compressor [n]: y use_celery [n]: y use_mailhog [n]: use_sentry [n]: use_whitenoise [n]: use_heroku [n]: Select ci_tool: 1 - None 2 - Travis 3 - Gitlab Choose from 1, 2, 3 [1]: keep_local_envs_in_vcs [y]: debug [n]: # 正式配置 [root@node1 ~]# /usr/local/python3/bin/cookiecutter https://github.com/pydanny/cookiecutter-django.git You've downloaded /root/.cookiecutters/cookiecutter-django before. Is it okay to delete and re-download it? [yes]: n Do you want to re-use the existing version? [yes]: yes project_name [My Awesome Project]: zanhu project_slug [zanhu]: description [Behold My Awesome Project!]: a Q&A website author_name [Daniel Roy Greenfeld]: jack domain_name [example.com]: email [jack@example.com]: version [0.1.0]: Select open_source_license: 1 - MIT 2 - BSD 3 - GPLv3 4 - Apache Software License 2.0 5 - Not open source Choose from 1, 2, 3, 4, 5 [1]: 5 timezone [UTC]: Asia/Shanghai windows [n]: n use_pycharm [n]: y use_docker [n]: n Select postgresql_version: 1 - 11.3 2 - 10.8 3 - 9.6 4 - 9.5 5 - 9.4 Choose from 1, 2, 3, 4, 5 [1]: 2 Select js_task_runner: 1 - None 2 - Gulp Choose from 1, 2 [1]: Select cloud_provider: 1 - AWS 2 - GCP 3 - None Choose from 1, 2, 3 [1]: 3 use_drf [n]: custom_bootstrap_compilation [n]: use_compressor [n]: y use_celery [n]: y use_mailhog [n]: use_sentry [n]: use_whitenoise [n]: y use_heroku [n]: Select ci_tool: 1 - None 2 - Travis 3 - Gitlab Choose from 1, 2, 3 [1]: keep_local_envs_in_vcs [y]: n debug [n]: y [WARNING]: You chose not to use a cloud provider, media files won't be served in production. [SUCCESS]: Project initialized, keep up the good work! 配置虚拟环境: [root@node1 ~]# cd zanhu/ [root@node1 zanhu]# pipenv3 --python 3.7 Virtualenv already exists! Removing existing virtualenv… Creating a virtualenv for this project… Pipfile: /root/Pipfile Using /usr/bin/python3 (3.7.7) to create virtualenv… ⠴ Creating virtual environment...created virtual environment CPython3.7.7.final.0-64 in 2141ms creator CPython3Posix(dest=/root/.local/share/virtualenvs/root-BuDEOXnJ, clear=False, global=False) seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/root/.local/share/virtualenv/seed-app-data/v1) activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator ✔ Successfully created virtual environment! Virtualenv location: /root/.local/share/virtualenvs/root-BuDEOXnJ # 这个就是虚拟环境目录 Virtualenv location: /root/.local/share/virtualenvs/root-BuDEOXnJ
设置本地和远程开发环境
本地新建zanhu 文件夹,然后附加到当前项目中
新建sftp
设置本地目录和远程目录的映射关系