One
Installation Apache2.4:sudo apt-get install apache2
Installing the Mod_wsgi module:sudo apt-get install Libapache2-mod-wsgi
To install Django:
sudo apt-get install python-setuptoolssudo apt-get Install Python-pip
sudo pip install Django
Go to the/etc/apache2/directory, the main configuration file is apache2.conf.
Create a new httpd.confof your own, in which the relevant configuration, mainly the DocumentRoot path. The main items are as follows:
<virtualhost *:80> * 80 ports for all IPs
ServerAdmin [email protected] * Email
Documentroot/home/ngb/likunheng/website_project/templates/app * Website root directory
Errorlog/home/ngb/likunheng/website_project/templates/error.log * Website Error logging
LogLevel warn
Customlog/home/ngb/likunheng/website_project/templates/access.log Combined * Website Access log
Serversignature on
wsgi.py in the Wsgiscriptalias//home/ngb/likunheng/website_project/model_view/website/wsgi.py *django Project(This is a big pit, 2.4 does not have the module directory, so also do not have to add mod_wsgi.so to module, and most of the online tutorials are said to put mod_wsgi.so into module, this kind of argument for 2.2Apache. )
alias/static//home/ngb/likunheng/software_folder/django-1.6.5/django/contrib/admin/static/* Background Data storage path
<Directory/home/ngb/Likunheng/Software_folder/Django-1.6.5/django/contrib/admin/static/>
Options Indexes followsymlinks MultiViews
AllowOverride None
Require all granted
</Directory>
alias/templates//home/ngb/likunheng/website_project/templates/app/* Template Storage path
<Directory/home/ngb/Likunheng/Website_Project/Templates/App/>
Options Indexes followsymlinks MultiViews
AllowOverride None
Require all granted
</Directory>
alias/website_project//home/ngb/likunheng/website_project/model_view/website/*django Project Path
<Directory/home/ngb/Likunheng/Website_Project/Model_View/WebSite/>
#Options Indexes followsymlinks MultiViews
#AllowOverride None
#Order Allow,deny
#Allow from all
Require all granted
</Directory>
</VirtualHost>
In the configuration apache2.conf , there are mainly the following:
ServerName localhost
DirectoryIndex index.html index.htm index.php
Adddefaultcharset GB2312 * Character encoding set
wsgipythonpath/home/ngb/likunheng/website_project/model_view/ *django project Path (a very important thing, do not add this line mod_ WSGI module will not find your settings.py)
# Include Module Configuration:
#IncludeOptional Mods-enabled/*.load
#IncludeOptional mods-enabled/*.conf
Include/etc/apache2/mods-enabled/*.load
Include/etc/apache2/mods-enabled/*.conf
# Include List of ports to listen on
#Include ports.conf
include/etc/apache2/httpd.conf * Own New httpd.conf
Include/etc/apache2/ports.conf
#Include/etc/apache2/sites-enabled/* * Comment out sites-enabled so that the default file does not take effect
include/etc/apache2/conf-enabled/*
So far. Congratulations to you. Complete the most important and difficult part of lamp configuration.
From then on, you can safely embark on the road to development and business.
Finish.
This article is from the "Blue Fin Dolphin" blog, please be sure to keep this source http://likunheng.blog.51cto.com/9527645/1571850
Apache2.4.7+mod_wsgi+django environment configuration under Ubantu System