Skip to content

Instantly share code, notes, and snippets.

@fdeandao
Last active December 23, 2015 22:49
Show Gist options
  • Save fdeandao/6706007 to your computer and use it in GitHub Desktop.
Save fdeandao/6706007 to your computer and use it in GitHub Desktop.
rserver
cd /root
git clone https://github.com/fdeandao/tutorial-django.git
cd tutorial-django
MYSQL=`which mysql`
Q1="CREATE DATABASE IF NOT EXISTS tutorial;"
Q2="GRANT ALL ON *.* TO 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';"
Q3="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}"
/usr/sbin/mysqld &
sleep 5
$MYSQL -u root -proot4mysql -e "$SQL"
python manage.py syncdb --noinput
echo "from wsgi import * >> createadmin.py
from django.contrib.auth.models import User
u, created = User.objects.get_or_create(username='\''admin'\'')
if created:
u.set_password('\''admin'\'')
u.is_superuser = True
u.is_staff = True
u.save()" > createadmin.py
python createadmin.py
python manage.py runserver 0.0.0.0:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment