超简单系列:ubuntu 13.04 安装 apache2.2+mod_wsgi+Django
1,Ubuntu更新系统
sudo apt-get update
sudo apt-get upgrade
2,安装apache,mod_wsgi,Django
sudo apt-get install apache2 libapache2-mod-wsgi python-django
更多Ubuntu系统内置安装包请搜索:Ubuntu Packages Search
3,配置Django环境
sudo mkdir /opt/wwwroot cd /opt/wwwroot
sudo django-admin startproject hello
创建wsgi文件
sudo mkdir /opt/wwwroot/hello/apache
sudo vi /opt/wwwroot/hello/apache/django.wsgi
文件django.wsgi贴入下面内容
django.wsgi内容
import os
import sys
sys.path.append('/opt/wwwroot')
sys.path.append('/opt/wwwroot/hello')
path = '/opt/wwwroot' if path not in sys.path:
sys.path.insert(0, '/opt/wwwroot') os.environ['DJANGO_SETTINGS_MODULE'] = 'hello.settings' import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
4,创建一个新的apache站点
sudo vi /etc/apache2/sites-available/hello
hello内容
<VirtualHost *:80>
ServerName hello.com
DocumentRoot /opt/wwwroot/hello
<Directory /opt/wwwroot/hello>
Order allow,deny
Allow from all
</Directory>
Alias /robots.txt /opt/wwwroot/hello/robots.txt
Alias /favicon.ico /opt/wwwroot/hello/favicon.ico
Alias /images /opt/wwwroot/hello/images
Alias /static /opt/wwwroot/hello/static
WSGIDaemonProcess hello.com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup hello.com
WSGIScriptAlias / /opt/wwwroot/hello/apache/django.wsgi
</VirtualHost>
激活hello站点
sudo a2ensite hello
sudo service apache2 reload
5,设置完毕打开浏览器进入输入ip地址,就可以看到Django欢迎界面了。
6. 如果发现文件访问不了,权限的问题
sudo chown -R (group).(user) (your project dir)
Django官网部署链接:https://docs.djangoproject.com/en/1.2/howto/deployment/
超简单系列:ubuntu 13.04 安装 apache2.2+mod_wsgi+Django的更多相关文章
- Ubuntu 13.04安装搜狗输入法
Ubuntu 13.04安装搜狗输入法 [日期:2013-07-08] 来源:Linux公社 作者:LinuxIDC.com [字体:大 中 小] 目标:在Ubuntu 13.04以及基于U ...
- ubuntu 13.04 安装 JDK
ubuntu 13.04 安装 JDK 具体步骤参详了如下链接: http://blog.csdn.net/yang_hui1986527/article/details/6677450 1.到 Su ...
- vmware 8下ubuntu 13.04安装vmware tools
在虚拟机vmware 8.0里安装了ubuntu 13.04.为了方便与主机交互,安装vmware tools. 解压后直接运行 ./vmware-install.pl 一路默认路径安装下来,到&qu ...
- Ubuntu 12.04 安装 Apache2+PHP5+MySQL
LAMP是Linux web服务器组合套装的缩写,分别是Apache+MySQL+PHP.此教程教大家如何在Ubuntu 12.04 LTS server 上安装Apache2服务器,包括PHP5(m ...
- Ubuntu 13.04 安装 GCC4.8.1
终于有了完整实现C++11的GCC 4.8.1. 给自己的系统升级吧. 下面的步骤可以安装GCC4.8.1, 内容来自:http://askubuntu.com/questions/312620/ho ...
- [Ubuntu Setup] Ubuntu 13.04 安装 ia32-libs
http://stackoverflow.com/questions/23182765/how-to-install-ia32-libs-in-ubuntu-14-04-lts sudo -i cd ...
- Ubuntu 13.04安装mysql workbench
1.如果你没有更换源,是主服务器的官网源,这时候你可以直接用sudo apt-get install mysql-workbench来安装(前提是已经装好mysql相关服务) 2.如果你第一条装不了, ...
- 64位Ubuntu 13.04 安装Bochs 2.3.5
bochs 2.3.5源码编译 网上编译bochs的资料非常多,基本的问题都有解决方案,我重点讲不常见的问题. 基本安装步骤 tar vxzf bochs-2.3.5.tar.gz cd bochs- ...
- Ubuntu 13.04 安装使用clang
其实很简单,就是用命令即可: apt-get install clang-3.2 clang-3.2-doc 主要说明一点,/usr/bin/c++链接原来指向g++,现在被改变了. $ ls /us ...
随机推荐
- Monkey简介及环境搭建(1)
简介:Monkey是Android SDK自带的测试工具,是一个命令行工具,可以运行在模拟器中或者实际设备中,它向系统发送伪随机的用户事件流(如按键输入,触摸屏输入,手势输入等),实现对正在开发的应用 ...
- idea tomcat控制台system.out.println是乱码
配置一下tomcat的信息.然后设置VM options.添加:-Dfile.encoding=UTF-8
- java的错题整理
为了阅读方便,我们写代码时要缩进,以便于更好的理解代码 对象是是具有相同属性和共同行为的一组类的实例,不是集合. B是标准格式,D没有对象接收它,所以这样子. boolean的默认值是false如果一 ...
- python操作rabbitMQ小结
1.安装rabbitMQ(与python无关) https://www.cnblogs.com/libra0920/p/7920698.html 2.python+rabbitMQ实现生产者和消费者模 ...
- js字符串拼接
1. 2. 3.
- ntpdata 同步时间
ntpdate用来同步时间 [root@localhost ~]# yum install -y ntp [root@localhost ~]# ntpdate time.windows.com # ...
- wordpress用Elementor拖拽生成酷炫页面
很多朋友看到wordpress网站做得很高大上,想知道是怎么做到的,其实很简单,用Elementor就能拖拽生成酷炫页面,ytkah就直接上干货了. 1.安装Elementor,到wordpress后 ...
- AppState使用
AppState使用 import React, { Component } from 'react'; import {AppRegistry,StyleSheet,Text,View,AppSta ...
- 怎么修改TOMCAT的默认主页为你自己项目的主页
如果webapp下有一个abc的文件来下有一个index.html,想设置为首页怎么操作 方法: 修改tomcat/conf/web.xml文件.在web.xml文件中,有一段如下:<welco ...
- 009-ThreadPoolExecutor运转机制详解,线程池使用1-newFixedThreadPool、newCachedThreadPool、newSingleThreadExecutor、newScheduledThreadPool
一.ThreadPoolExecutor理解 为什么要用线程池: 1.减少了创建和销毁线程的次数,每个工作线程都可以被重复利用,可执行多个任务. 2.可以根据系统的承受能力,调整线程池中工作线线程的数 ...