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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. [Python] Create a Django project in Pycharm

    From: http://blog.csdn.net/u013088062/article/details/50158239 From: http://blog.csdn.net/u013088062 ...

  4. Django project troubleshootings

    1. 当django project文件夹放到cgi-bin目录下面时会出现下面的错误: [Wed Jan 09 01:52:52.611690 2019] [core:notice] [pid 15 ...

  5. django project 的快速构建

    2003年,堪萨斯(Kansas)州 Lawrence 城中的一个 网络开发小组 ——World Online 小组,为了方便制作维护当地的几个新闻站点(一般要求几天或者几小时内被建立),Adrian ...

  6. 18 12 30 新建一个 django project

    1. 新建一个 django project 1 2 django-admin.py startproject project_name 特别是在 windows 上,如果报错,尝试用 django- ...

  7. My First Django Project (3) - Apache set up

    Holy moly!!!!因为漏了一下斜杠,害我反复调试了2,3天,无法读取static 文件,一直找不出原因,后来在apache的error.log中发现了原因. 1. 下载了apache 2.4, ...

  8. 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 ...

  9. Linux下安装Apache并以mod_wsgi方式部署django站点

    源码编译方式安装Apache 首先下载Apache源码压缩包,地址为http://mirror.bit.edu.cn/apache/httpd/ 继续下载apr和apr-util压缩包,地址为http ...

随机推荐

  1. 层层递进Struts1(七)详解DispatchAction

    通过前面几篇博客,不知道大家有没有发现这个问题,虽然现在可以灵活控制跳转了,但是Action的数量还是比较多,如何既能保证跳转灵活,还能减少Action的数量?这就是我们这篇博客所说的Dispatch ...

  2. iOS 百度地图 小的特点demo

    先上图的样子 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMDEyMzIwOA==/font/5a6L5L2T/fontsize/400/fill ...

  3. DECIMAL Data Type

    In MySQL, DECIMAL(M,D) and NUMERIC(M,D) are the same, and both have a precision of exactly M digits. ...

  4. struts2 convention-plugin实现零配置

    零配置并不是没有配置,而是通过约定大于配置的方式,大量通过约定来调度页面的跳转而使得配置大大减少.使得Action等配置不必写在Struts.xml中. convention-plugin的约定 1. ...

  5. STL的基本使用之关联容器:map和multiMap的基本使用

    STL的基本使用之关联容器:map和multiMap的基本使用 简介 map 和 multimap 内部也都是使用红黑树来实现,他们存储的是键值对,并且会自动将元素的key进行排序.两者不同在于map ...

  6. C语言循环的嵌套

    注:参考网络资源拟制,如雷同请见谅循环的嵌套:一个循环体语句中又包含另一个循环语句,称为循环嵌套.嵌套注意事项:1.使用循环嵌套时,内层循环和外层循环的循环控制变量不能相同.2.循环嵌套结构的书写,最 ...

  7. Linux - CentOS6.5服务器搭建与初始化配置详解(上)

    1.新建一个虚拟机 选择典型 单机下一步 p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm 0cm 0.0001pt; text-align: ...

  8. Java异常之try,catch,finally,throw,throws

    Java异常之try,catch,finally,throw,throws 你能区分异常和错误吗? 我们每天上班,正常情况下可能30分钟就能到达.但是由于车多,人多,道路拥挤,致使我们要花费更多地时间 ...

  9. node里如何查看浏览器信息

    'use strict'; let http = require(`http`); http.createServer((req, res) => { console.log(req.heade ...

  10. 2016年11月1日——jQuery源码学习笔记

    1.instanceof运算符希望左操作数是一个对象,右操作数标识对象的类.如果左侧的对象是右侧类的实例,则表达式返回true,否则返回false 2.RegExp.exec() 如果 exec() ...