--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 on Apache with Mod_wsgi on Linux