• win10环境下配置django+Apache2.4.38+python3.6项目


    1.)Apache-2.4.38-win64-vc15下载地址:

    https://www.apachelounge.com/download/VC14/

    解压httpd-2.4.38-win64-VC14.zip到目标路径,我将其安装在E:pythonstudy2019-1-3目录下

    2.)mod_wsgi-4.6.5+ap24vc15-cp36-cp36m-win_amd64.whl下载地址:

    https://www.lfd.uci.edu/~gohlke/pythonlibs/

    注意要与你的python版本和Apache版本吻合

    安装:

    pip install "mod_wsgi‑4.5.24+ap24vc14‑cp36‑cp36m‑win_amd64.whl"

    3.)修改Apache配置

    a) 打开conf/httpd.conf 文件,修改服务器根目录:

    修改SRVROOT"/Apache24" 为SRVROOT "E:/pythonstudy/2019-1-3/Apache24"

    修改ServerRoot "c:/Apache24"为 ServerRoot  "E:/pythonstudy/2019-1-3/Apache24"

    然后查找所有的"c/Apache24",全部改成 " "E:/pythonstudy/2019-1-3/Apache24"

    b) 修改监听端口(可选,根据实际需要)

    Listen 80 改成 Listen 8009

    c)修改服务器名(建议)

    #ServerName www.example.com:80 改成IP:80

    注:这里我没有注册域名,直接改为本机ip

    d) 去掉#注释,打开访问日志

    CustomLog "logs/access.log" common

    e) 去掉#LoadModule rewrite_module modules/mod_rewrite.so的“#”号注释

    f)找到如下配置

    <Directory />
    AllowOverride none
    Require all denied
    </Directory>

    修改为

    <Directory />
    AllowOverride All
    Require all granted
    </Directory>

    g) 在conf/httpd.conf文件末尾添加如下内容:

    LoadFile "E:/soft/python3.6/python36.dll"
    LoadModule wsgi_module "E:/soft/python3.6/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
    WSGIPythonHome "E:/soft/python3.6"
    WSGIScriptAlias / E:/AutoTestingPlatform/AutotestPlatform/wsgi.py
    WSGIPythonPath E:/AutoTestingPlatform/website
    Alias /static/ E:/AutoTestingPlatform/website/static/
    <Directory E:/AutoTestingPlatform/website/static>
    Require all granted
    </Directory>

    <Directory E:/AutoTestingPlatform/AutotestPlatform/>
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>

    4.)启动Apache

    a) 把Apache注册为Windows服务

    (注此处需要以管理员身份运行CMD)

    E:pythonstudy2019-1-3Apache24in>httpd.exe -k install -n Apache2.4
    Installing the 'Apache2.4' service
    The 'Apache2.4' service is successfully installed.
    Testing httpd.conf....
    Errors reported here must be corrected before the service can be started.

    注:该命令把Apache注册为Windows服务,反之uninstall -n 服务器名

    b) 启动Apache服务

    E:pythonstudy2019-1-3Apache24in>httpd.exe -k start

    c) 停止Apache服务

    E:pythonstudy2019-1-3Apache24in>httpd.exe -k stop

    d)删除Apache服务

    sc delete "服务名"

    注意必须以管理员身份运行该命令行,才能正常删除服务

    5.) 通过浏览器访问,url为IP:8009

  • 相关阅读:
    NOI-01:查找最接近的元素 基本二分
    C#学习笔记之——数据库操作的相关类
    Lua学习笔记——环境安装(Windows和MacOS)和在MacOS安装时错误解决方法
    Ubuntu下对数据库的操作
    Git常用操作
    [Unity游戏开发]常用类之Time类
    [Unity游戏开发]四元数Quaternion
    [Unity游戏开发]常用类之Transform类
    [Unity游戏开发]常用类之Component类
    [Unity游戏开发]射线(Ray)
  • 原文地址:https://www.cnblogs.com/wuxunyan/p/10477110.html
Copyright © 2020-2023  润新知