--> 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/