Tutorial 2: Setting local Django devlopment environment on linux mint


I was introduced to Djnago some time ago, it was on amazon accessed using git. I did not set any local environment yet To make any change I would first edit it on my system then push to assembla git repo and then pull it on server and restart and if I made any silly mistake redo the same thing. So after 2-3 changes I got sick of it. There was a better solution that was hard to achieve in windows.

So without wasting time I will list the steps and errors

1. Install any linux distro 

(the one with which you are comfortable and have good software repo system), I am using mint which is ubuntu derivative

2. SOFTWARES from ubuntu repo

sudo apt-get install python-django
sudo apt-get install mysql-server
sudo apt-get install mysql-python
sudo apt-get install python-pip
optional-
sudo apt-get install python-dev
sudo apt-get install phpmyadmin

3. pipy apps 

If you have already been working on remote server you may have install some local applications like django-registration or some json related apps
so use
sudo pip install app1
sudo pip install app2

4. DB user 

(If you have phpmyadmin installed just go to 127.0.0.1/phpmyadmin )
In terminal type mysql -u root -p
Enter the password you set while installing
mysql> CREATE DATABASE db;
mysql> GRANT ALL ON db.* TO 'user'@'%' IDENTIFIED BY 'pwd';
Query OK, 0 rows affected (0.03 sec)

mysql> quit
Bye

5. sudo service mysql restart


6. If starting from scratch 

django-admin startproject projname

Now go to folder /projname/settings.py
Add database details

now go to directory where manage.py of your project is located

sync db
$python manage.py syncdb - will create the tables for models defined in proj
set superuser when terminal asks for it after creating tables

$python  manage.py runserver

Go to 127.0.0.1:8000 to see your worked page



Comments

Popular posts from this blog

Type of Common Charts used in visualization

बैगन

Building a Better Future: Pathways Over Chariots