zoukankan      html  css  js  c++  java
  • 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

    设置本地目录和远程目录的映射关系

  • 相关阅读:
    必须为接口 System.Collections.IComparer 实现
    C#编写的windows程序随系统启动的问题
    ReportViewer导出Excel的问题
    英语听力的技巧
    Windows中无法删除文件的解决办法
    RDLC/RDL 动态报表
    Only export to PDF format from ReportViewer addin
    提高ASP.Net网站性能
    关于Spring 国际化 No message found under code 的解决方案
    Axis2中使用WSAddressing协议
  • 原文地址:https://www.cnblogs.com/reblue520/p/13745751.html
Copyright © 2011-2022 走看看