Tuesday, June 18, 2013

Setting up Django in Eclipse

I am using Windows 8, Django 1.5.2, Eclipse IDE for Java EE Developers 64 bit, MySQL Workbench 5.2.47 CE, Python 2.7.5 64 bit since I can't get Python 3.3 to work because the requirement of MySQL-python-1.2.3.win-amd64-py2.7 is Python 2.7. ez_setup.py just copy and paste the content and save it as ez_setup.py same with get-pip.py and place it to where your Python27 folder is located, as for me it is in C:\Python27. Add: C:\Python27;c:\python27\scripts;c:\python27\bin to PATH. 

In your command prompt type cd C:\Python27 then python ez_setup.py. When it's done type python get-pip.py. Next is to install django just type in you command prompt pip install django

After the following software mentioned above are installed, in your Eclipse go to help and click eclipse market place as shown in Figure 1


Figure 1

  
Then in the search tab type Django and click install, in my case it is already installed, basically you will just have to click and agree to everything until you are ask to click finish.
Figure 2

Next is go to preference
Figure 3


In your preference window click PyDev and then choose Interpreter - Python then click Auto Config and basically just agree to what is ask and click that is related to your python 2.7. 
Figure 4



Then add Django folder to PYTHONPATH as shown in Figure 5, click ok and apply settings
Figure 5

In creating a new project just go to file, new then others, as shown below.
Figure 6
Then choose PyDev Django Project
Figure 7

Type in the project name. I choose python 1 because that is the file name of my interpreter where python27 is created, then click next
Figure 8


In Django Settings before you type in the info of your mysql details you have to create firs a database in MySQL Workbench, so basically in Figure 9 are the info of my mysql.
Figure 9


In MySQL Workbench configuration just click Create New EER Model
Figure 10


and double click mydb and type below the mysql database filename that you desire, in my case its coop as shown in Figure 9, then save your database.
Figure 11

After my project is created go to run configuration as shown below 
Figure 12

Then follow the image below
Figure 13


Just type in the name Django 1.5.1 and then browse the Django file in your computer as for me it is located in C:\Django-1.5.1 
Figure 14
click OK until you find the image below and you are ready for coding your Django


Resources: 
Django: Installing Eclipse and PyDev for djangoUsing Django 1.4 with EclipseInstall Django in Eclipse with PyDev on Windows 8

No comments:

Post a Comment