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 ...
随机推荐
- hdoj 1276 士兵队列训练问题【模拟】
士兵队列训练问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- ListView 分类: WinForm 2014-07-18 22:03 289人阅读 评论(0) 收藏
一.ListView类(转载) 1.常用的基本属性: (1)FullRowSelect:设置是否行选择模式.(默认为false) 提示:只有在Details视图该属性才有意义. (2) GridLin ...
- linux操作系统cron详解
Linux操作系统定时任务系统 Cron 入门 cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业.由于Cron 是Linux的内置服务,但它不自动起来,可以用以下的方法启动 ...
- 移植QT到ZedBoard(制作运行库镜像) 交叉编译 分类: ubuntu shell ZedBoard OpenCV 2014-11-08 18:49 219人阅读 评论(0) 收藏
制作运行库 由于ubuntu的Qt运行库在/usr/local/Trolltech/Qt-4.7.3/下,由makefile可以看到引用运行库是 INCPATH = -I/usr//mkspecs/d ...
- Linux多线程——使用互斥量同步线程
前文再续,书接上一回,在上一篇文章: Linux多线程——使用信号量同步线程中,我们留下了一个如何使用互斥量来进行线程同步的问题,本文将会给出互斥量的详细解说,并用一个互斥量解决上一篇文章中,要使用两 ...
- [Javascript] Array - Conact
For example there are two array of object and you want to print out each element, it is bad if you u ...
- linux_2.6内核内存缓冲与I/O调度机制:
http://blog.csdn.net/kaiwii/article/details/7030178 到底是BIO还是BH?答案是BIO与BH
- Form实现无刷新上传文件并返回自定义值
今天开发过程中遇到了这样一个问题:需要将Excel上传至服务器进行解析,但是在文档不合适的情况下希望可以不刷新页面提示用户文档不合适.冥思苦想了半天,在网上找了不少资料最终试验成功,在此分享下处理方法 ...
- 动态添加子视图 UIView 的正确方法
很多时候哥比较喜欢用代码添加视图,特别是要同时加很多UIView时,而且跟 xib 比起来代码更容易管理,在多人的项目中代码不容易 conflict. 但小牛哥最近发现很多新人都不太清楚正确的使用方法 ...
- ASP.NET MVC 第五回 ActionResult的其它返回值
我们上边所看到的Action都是return View();我们可以看作这个返回值用于解析一个aspx文件.而它的返回类型是ActionResult如 public ActionResult Inde ...