Skip to content

Instantly share code, notes, and snippets.

@4E71
Created July 4, 2012 02:03
Show Gist options
  • Save 4E71/3044736 to your computer and use it in GitHub Desktop.
Save 4E71/3044736 to your computer and use it in GitHub Desktop.
django: getting started
# Django installation steps for OS X
# 1) install virtualenv and pip
curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
python virtualenv.py my_new_env
. my_new_env/bin/activate
(my_new_env)$ pip install ...
# 2) get the latest django source
git clone git://github.com/django/django.git django-trunk
# 3) install django
pip install -e django-trunk/
# 4) confirm installation using python interpreter
python
>>> import django
>>> print django.get_version()
# outputs version number
# Mysql installation instructions. Assumes homebrew is installed.
# update homebrew
brew update
# install MySQL
brew install mysql
# post-install setup
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
# test install by starting manually
mysql.server start
# setup password and security
# remember to:
# 1) remove anonymous users from mysql
# 2) disallow root login remotely
# 3) remove test database and accesss to it
# 4) reload priviledge tables
/usr/local/Cellar/mysql/5.5.25/bin/mysql_secure_installation
# create your database
mysql.server start
mysql -u root -p
# enter password
mysql> CREATE DATABASE <database_name>;
mysql> CREATE USER '<name>'@'localhost' IDENTIFIED BY '<password>';
mysql> GRANT ALL PRIVILEGES ON *.* TO '<name>'@'localhost' WITH GRANT OPTION;
# install the connector
pip install MySQL-python
# create database tables for Django apps
python manage.py syncdb
# go to mysql to view the tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment