很多教程都是在linux上搭建,windows上似乎天生不太适合,但是我还是愿意试试这个坑。

首先 交代一下自己的环境

python3.5.2 64位

django 1.10.3

apache 2.4 64位

windows 10

重点在apache上。

python 和django 相信有兴趣看这篇文章的基本上也都已经了解了。

******************分割线*******************************************************

安装Apache2.4

地址:http://www.apachelounge.com/download/

下载:vc_redist.x64.exe 直接安装  vc_redist_x64/86.exe.

下载:httpd-2.4.17-win64-VC14.zip  

配置环境变量:path增加D:\Apache24\bin;

解压到指定目录 修改配置文件: http.conf (下面内容中的ServerRoot改成你自己的实际Apche解压路径)

    ServerRoot "D:/Apache24"
……
Listen 127.0.0.1:8081 #修改端口号
……
ServerName www.example.com:8081
……
DocumentRoot "D:/Apache24/htdocs"
<Directory "D:/Apache24/htdocs">
……
ScriptAlias /cgi-bin/ "D:/Apache24/cgi-bin/"
……
<Directory "D:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
    启动apache服务:
    cmd>httpd 
http://127.0.0.1:8081/index.html

It works!

apache配置成功

******************分割线*******************************************************

安装mod_wsgi

先安装:pip install wheel

安装mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl

下载:mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl

地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi

pip 安装:pip install mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl

******************分割线*******************************************************

配置Apache2.4、mod_wsgi、django项目工程

1. 将C:\Python35\mod_wsgi.so 拷贝至 D:\Apache24\modules下

(mod_wsgi.so 只有mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl安装成功后才能找到)

2.修改apache2.4的http.conf文件:

#添加mod_wsgi.so 模块

       LoadModule wsgi_module modules/mod_wsgi.so
    3.配置django项目 修改http.conf
 

#添加mod_wsgi.so 模块    
LoadModule wsgi_module modules/mod_wsgi.so #指定静态资源路径 Alias /statics/ F:/pydj/newsCollection/toutiao/statics/
<Directory F:/pydj/newsCollection/toutiao/statics>
    Require all granted   
</Directory>   
     
#指定newsCollection项目的wsgi.py配置文件路径   
WSGIScriptAlias / F:/pydj/newsCollection/newsCollection/wsgi.py #指定项目路径   
WSGIPythonPath F:/pydj/newsCollection
     
<Directory F:/pydj/newsCollection/newsCollection>   
    <Files wsgi.py>   
        Require all granted
    </Files>
</Directory>
*************分割线************************************************************
wsgi.py内容:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
 
#注意上面的myweb,是改成自己的项目名称,比如上图中 newsCollection。参考上上图中的目录结构。
*************分割线************************************************************
配置django工程setting.py
    ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
 
最后告诉一点 Apche 启动的时候报错会有log, httpd-2.4.23-x64-vc14-r3\Apache24\logs 目录下 error信息,慢慢排错

windows10搭建django1.10.3+Apache2.4的更多相关文章

  1. Windows10搭建PHP7开发环境

    原文:Windows10搭建PHP7开发环境 3年前写了一篇<Windows下搭建PHP开发环境>之后就再也没有碰过PHP了,最近新发布了PHP7然后回去看了一下之前写的文章,发现很多配置 ...

  2. Windows10 搭建 ElasticSearch 集群服务

    一.前言 集群的搭建需要多台机器,之前我使用 ubuntu 16.04 搭建过 hadoop 的单机模式和分布式模式,这个今后会写,今天先写一篇使用 < Windows10 搭建 Elastic ...

  3. Django1.10环境安装

    在Ubuntu14上 一 安装脚本 wget https://github.com/django/django/archive/master.tar.gz apt-get install python ...

  4. 将python2.7+django1.10部署到SAE上

    首先我想说的是我为什么选择SAE呢?本人学生一枚,没钱.然后sae好像又有免费的一定限额,所以我就选了它. 期间曲折颇多,实在不是三言两语所能道情的.各种百度,谷歌,最后所幸成功了,幸哉! 主要参考了 ...

  5. win8.1 环境下搭建PHP5.5.6+Apache2.4.7

    本文主要阐述在windows8及win8.1 环境下搭建PHP5.5.6+Apache2.4.7. 1.软件准备 apache 2.4.7:http://pan.baidu.com/s/1iUPif ...

  6. ubuntu 11.10 安装apache2 tomcat6

    ubuntu 11.10 安装apache2 tomcat6 导读 Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目 ...

  7. django1.10使用本地静态文件

    django1.10使用本地静态文件方法 本文介绍的静态文件使用,是指启动web站点后,访问静态资源的用法,实际静态资源地址就是一个个的url 如果没有启动web站点,只是本地调试html页面,那直接 ...

  8. Cenos6.6 升级 python3.5.2 安装配置 django1.10

    1 准备编译环境(环境如果不对的话,可能遇到各种问题,比如wget无法下载https链接的文件) yum groupinstall 'Development Tools' yum install zl ...

  9. lamp环境搭建(centos6.9+apache2.4+mysql5.7+php7.1)

    lamp环境搭建(centos6.9+apache2.4+mysql5.7+php7.1) 安装前准备:CentOS 6.9 64位 最小化安装 yum install -y make gcc gcc ...

随机推荐

  1. Codeforces Round #375 (Div. 2)

    A. The New Year: Meeting Friends 水 #include <set> #include <map> #include <stack> ...

  2. 祝贺 Linux 25 岁:25 个关于 Linux 的惊人真相!【转载】

    作者:Javen Fang链接:https://zhuanlan.zhihu.com/p/22222383来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 25 年前的这 ...

  3. Git Merge Commit忘了选分支?数据丢失? 刚刚做的都丢失了?别急!

    1.打开终端,进入到对应的git 目录,也就是你的项目目录. 2.然后输入 git reflog,找到自己commit的版本 3.根据对应的编码输入指令,如:git checkout e53fa44( ...

  4. 浅谈Margin和Padding值设置成百分数的布局

    转自:问说网http://www.uedsc.com/discussion-margin-and-padding-values.html Margin和Padding是我们在网页设计经常使用到的CSS ...

  5. three.js自定义形状

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...

  6. Python2 下 Unicode 的一个小bug

    关于Python的编码问题已经是老生常谈了,此处主要是介绍一个罕见的问题,也算是Python2的一个bug了(Python3不会有此问题). 在有时候我们去爬取网页或者调用一些第三方库获取文本的时候, ...

  7. c语言完成宽带拨号

    学校的网络每次开机都需要手动登陆,于是用c写了一个自动登陆的小程序... 程序功能超级简单...只是懒得每次都登陆... PS:代码功能具体没有测试...我自己用的是python #include & ...

  8. *HDU1800字典树

    Flying to the Mars Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  9. 总结-computer

    常见问题 1.任务栏位置:%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar 2.锁定到任务栏的图标不见了: ...

  10. bahuanghou111

    #include<stdio.h> int map[8][8]={0}; int count=0; int safe(int x,int y) { int i; int j; for(i= ...