Apache:To Config The Vhost of Django Project
It is not a good idea to use dev server in Production Environment.
Apache or Nginx are good choice.Both of them are of great used as the web server.
I'm trying to deploy in apache.
The File Structre:
If you've read djangoproject's documentation,you will find that my project's file structure is a bit different from what the documentation show(via)
Both are ok.

Imagine that you have the apache installed.And now ,lets do it 1 by 1.
Step 1:Edit The httpd.conf
/path/to/the/apache/conf/thhpd.conf
Add a new line just at the end of the file.It seems to be looked like this:

The windows WAMP version:

You need do nothing but just add this line in httpd.conf.I suggest you to do like that,because to config your apache_django project in a included file will not break the protect the integrity of httpd.conf.
Step 2:Add mod_wsgi in to the modules path of apache:
While the Python gets a x86 and x64 version, and it is the same with the mod_wsgi
First, download the right version of mod_wsgi.For example,I have Python2.7.x.amd64 and Apache 2.4.x installed in my pc(x64).So, I need to use (via)

Uzip the package and you will get a mod_wsgi.so.
Put it in the apache modules

Step 3:Edit the apache_django.conf and apache_django.wsgi
Apache_django.conf
Ps.in this config file,I load the mod_wsgi module,config the vietual python env
Listen the 8000 port which is used in my django project and in the <VirtualHost 127.0.0.1:8000> ….. </VirtualHost> I config something of my project.

Apache_django.wsgi
In this file ,I add the project into the python path so that django driver can get the application

Step 4:cp the project files in to the www:
Seems like that:

Let's check into it

After all above,restart apache server.type http://127.0.0.1:8000

Shit,what's happened?
Check in the log path No Error found

Check httpd.conf:

Add this:

Check www root:seems ok

OK,restart apache:
Near to success!

Check in the error log:

….No module…….orz….
Apache_django.wsgi line 3

Maybe there's something wrong with my WSGIPythonPath

Let's have a look at where the virtual env's site-packages are:

……………………………………..orz…
Change it!

Restart apache service! 


I give up…
Tomorrow will be ok
Time to sleep…
Apache:To Config The Vhost of Django Project的更多相关文章
- Start Your Django Project in Nginx with uWsgi
Step 0:Install A,B,C,blabla needed This can be seen in my another article in the blog.click here(una ...
- Prepare tasks for django project deployment.md
As we know, there are some boring tasks while deploy Django project, like create db, do migrations a ...
- [Python] Create a Django project in Pycharm
From: http://blog.csdn.net/u013088062/article/details/50158239 From: http://blog.csdn.net/u013088062 ...
- Django project troubleshootings
1. 当django project文件夹放到cgi-bin目录下面时会出现下面的错误: [Wed Jan 09 01:52:52.611690 2019] [core:notice] [pid 15 ...
- django project 的快速构建
2003年,堪萨斯(Kansas)州 Lawrence 城中的一个 网络开发小组 ——World Online 小组,为了方便制作维护当地的几个新闻站点(一般要求几天或者几小时内被建立),Adrian ...
- 18 12 30 新建一个 django project
1. 新建一个 django project 1 2 django-admin.py startproject project_name 特别是在 windows 上,如果报错,尝试用 django- ...
- My First Django Project (3) - Apache set up
Holy moly!!!!因为漏了一下斜杠,害我反复调试了2,3天,无法读取static 文件,一直找不出原因,后来在apache的error.log中发现了原因. 1. 下载了apache 2.4, ...
- Django project structure: how does static folder, STATIC_URL, STATIC_ROOT work
So I've been messing up with Django(1.6+) project setting for quite sometime, this is what i finally ...
- Linux下安装Apache并以mod_wsgi方式部署django站点
源码编译方式安装Apache 首先下载Apache源码压缩包,地址为http://mirror.bit.edu.cn/apache/httpd/ 继续下载apr和apr-util压缩包,地址为http ...
随机推荐
- 又是一道水题 hdu背包
Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额.如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负) ...
- UVaLive2572 poj1418 UVa1308 Viva Confetti
一次放下n个圆 问最终可见的圆的数量 应该是比较经典的问题吧 考虑一个圆与其他每个圆的交点O(n)个 将其割成了O(n)条弧 那么看每条弧的中点 分别向内向外调动eps这个点 则最上面的覆盖这个点的圆 ...
- JDBC基本知识
JDBC的作用 JDBC为java访问数据库提供通用的API,可以为多种关系数据库提供统一访问.因为SQL是关系式数据库管理系统的标准语言,只要我们遵循SQL规范,那么我们写的代码既可以访问MySQL ...
- spring security +spring boot 自定义 403 页面
用的spring security 做的权限控制, 当 访问没有权限, 跳转 会跳到默认403 页面.不符合当前项目需求. 一下是解决方式: package com.ycmedia; import ...
- Python安装scipy
1.下载numpy+mkl 下载链接:http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy 2.下载scipy 下载链接:http://www.lfd.uc ...
- WCF服务发布到IIS时候,只能根据hostname访问,不能根据IP地址访问的解决办法
本文转载:http://www.cnblogs.com/deerbox/archive/2013/05/13/3076248.html 环境: VS2010 sp1,.net framework 4. ...
- PDF模板报表导出(Java+Acrobat+itext)
1. 首先要安装Adobe Acrobat,装好之后用Acrobat从一个word,excel或者pdf中转换一个pdf模板,我做的模板很简单,直接写一个简单的word再生成一个pdf表单,之后编辑文 ...
- 获取文件CRC和MD5
unit untCRCMD5; interface { 获取文件CRC校验码 } function GetFileCRC(const iFileName: string): String; { 获取字 ...
- Windows、Ubuntu双系统重装windows系统后grub引导的修复及默认启动项的修改
今天帮童鞋重装系统,他的电脑是Windows.Ubuntu双系统,需要重装的系统是windows,据说是因为很多游戏都只支持64位,要给换成64位的 = =... 于是我就帮他装了个wind ...
- android开发之使用Messenger实现service与activity交互
service与activity交互的方式有多种,这里说说使用Messenger来实现两者之间的交互. Service程序 public class MessengerService extends ...