Troy Scott

beans & bits

Creating Your First Python Project

16 Dec 2012

In the previous post we downloaded Eclipse and PyDev.  I also recommended signing up for GitHub or Bitbucket.  Why?  Because the best way to manage your code is by using a source control system.     Github and Bitbucket offer Private accounts for a reasonable fee and Public projects are free. 

When i start a new project (e.g. Django Web Site), i use the following approach:

  • Setup a New GitHub Repository (see this post)
  • Add the GitHub project to Eclipse
  • Use the Eclipse PyDev Perspective and start developing

For this example, instead of using a “new” GitHub project, we will import an existing project django project to provide some structure to the solution.   Open Eclipse (close the “Welcome Page” if it is still open) and select  Window>Open Perspective> Other ….   Next select “Git Repository Exploring”.  Ignore any warnings about git.

The easiest way to add a project to eclipse is to clone an existing git project.  Navigate to the following project.  In Eclipse, click “Clone a Git Repository”.  Paste the URL and enter your username and password for the git account..  Click Next and Next again.  You can default the project to your workspace or select a different folder.

If everything has been entered correctly the project will be cloned in your workspace folder:  Expand the git repository project tree and select the “Working Directory”.  Right click the “Working Directory” and perform the following steps.  

  • Select “Import Projects …”
  • Select radio button:   “Import as general project “
  • Click Next and then Click Finish
  • Select Window>Open Perspective>Other
  • Select PyDev

You have now successfully added a Django Python project to Eclipse.   Its important to remember that creating the project in GitHub or BitBucket simplifies setting up the project in Eclipse.   Next post we will make some changes to the project commit the changes locally and then push the changes to the remote repository (e.g. GitHub).

comments powered by Disqus