Install Django on Apache with mod_wsgi on linux
2015-02-09 17:43
239 查看
--> sudo apt-get install python-mysqldb
--> install django
--> sudo apt-get install mysql-server
root/root123
--> sudo apt-get install apache2
--> sudo apt-get install libapache2-mod-wsgi
--> mkdir ~/Documents/sandbox/djcode
--> vim firstweb.wsgi
import os
import sys
sys.path = ['/var/www/firstweb'] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
--> sudo apt-get install vim
--> cd /etc/apache2/sites-available/
--> sudo -s
--> vim firstweb.conf
<VirtualHost *:80>
WSGIScriptAlias / /home/plex/firstweb.wsgi
ServerName firstweb.com
Alias /static /var/www/firstweb/static/
<Directory /var/www/firstweb/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
--> a2ensite firstweb.conf
a2dissite
--> cd /var/www
--> django-admin.py startproject firstweb
--> apachectl restart
or /etc/init.d/apache2 restart
service apache2 reload
--> vi /etc/hosts
--> mysql -u root -p
show databases;
create database firstweb;
--> vim settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'firstweb',
'USER': 'root',
'PASSWORD': 'root123',
'HOST': '',
}
}
--> python manage.py syncdb
username: root
password: root123
--> apachectl restart
--> cp -r /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/ /var/www/firstweb/
--> chown -R www-data apc_project_test/
--> install django
--> sudo apt-get install mysql-server
root/root123
--> sudo apt-get install apache2
--> sudo apt-get install libapache2-mod-wsgi
--> mkdir ~/Documents/sandbox/djcode
--> vim firstweb.wsgi
import os
import sys
sys.path = ['/var/www/firstweb'] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
--> sudo apt-get install vim
--> cd /etc/apache2/sites-available/
--> sudo -s
--> vim firstweb.conf
<VirtualHost *:80>
WSGIScriptAlias / /home/plex/firstweb.wsgi
ServerName firstweb.com
Alias /static /var/www/firstweb/static/
<Directory /var/www/firstweb/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
--> a2ensite firstweb.conf
a2dissite
--> cd /var/www
--> django-admin.py startproject firstweb
--> apachectl restart
or /etc/init.d/apache2 restart
service apache2 reload
--> vi /etc/hosts
--> mysql -u root -p
show databases;
create database firstweb;
--> vim settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'firstweb',
'USER': 'root',
'PASSWORD': 'root123',
'HOST': '',
}
}
--> python manage.py syncdb
username: root
password: root123
--> apachectl restart
--> cp -r /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/ /var/www/firstweb/
--> chown -R www-data apc_project_test/
相关文章推荐
- Deploying Django with Apache and mod_wsgi Based on Red Hat Enterprise Linux Server
- Linux下安装Apache并以mod_wsgi方式部署django站点
- linux+django+apache+mod_wsgi+eclipse+python2.7 环境的搭建
- Linux+Django+Python+Wsgi配置过程 Linux下配置Apache+Mod_Wsgi+Django环境 部署django项目
- apache,python,mod_wsgi,django,mysql在linux下的安装
- How to install SVN server with USVN, Apache, mod_dav_svn on CentOS 6
- linux安装 apache2.2 django mod_wsgi
- IntegrationWithDjango - modwsgi - How to use Django with mod_wsgi. - Python WSGI adapter module for Apache. - Google Project Hosting
- Webpy + Apache with mod_wsgi on Ubuntu http://webpy.org/cookbook/mod_wsgi-apache-ubuntu
- Linux下安装Apache并以mod_wsgi方式部署django站点
- Linux下安装Apache并以mod_wsgi方式部署django站点
- Linux下安装Apache并以mod_wsgi方式部署django站点
- Linux下配置Apache+Mod_Wsgi+Django环境
- windows+apache+mysql+django+mod_wsgi安装
- Installing Apache Tomcat 5.5/6/7 with a multi-instance layout on Linux
- [Python]Install Django Web Framework with Mod_python
- How To Install LAMP (Linux, Apache, MySQL, PHP) On Ubuntu 11.04/11.10/12.04
- django + apache + windows server 2003 + sql server 2005 + mod_wsgi 配置
- How to use Django with Apache and mod_wsgi
- Linux+apache+mysql+python+mod_python+Django