zoukankan      html  css  js  c++  java
  • python文件 启动django项目

    1.查看端口占用

    C:>netstat -ano|findstr 8000  
      TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       8124  
      UDP    0.0.0.0:8000           *:*                                    8124  
      
    C:>tasklist |findstr 8124  
    KGService.exe                 8124 Console                    3     14,480 K  
      
    C:Usersliyunzhi>taskkill /pid 8124 /F  
    成功: 已终止 PID 为 8124 的进程。  
    

    2. run_django.py 放在项目目录下面

    import os
    import subprocess
    import sys
    
    path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    
    
    def run_shell(shell):
        print(shell)
        cmd = subprocess.Popen(shell, stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=False, stdout=sys.stdout, universal_newlines=True, shell=True, bufsize=1)
    
        cmd.communicate()
        return cmd.returncode
    
    
    if __name__ == '__main__':
        test = run_shell("E:\02-software_python\01-python\python.exe {}\manage.py runserver 0.0.0.0:8000 ".format(path))
    

      

  • 相关阅读:
    eclipse c++
    smb
    osx mount nfs/smb
    0927用的
    0926 隐藏地址栏
    0921笔记
    生成文件并下载
    在线图标
    react redux
    electron
  • 原文地址:https://www.cnblogs.com/yoyo1216/p/14467653.html
Copyright © 2011-2022 走看看