Debug Google App Engine in eclipse

Source: Internet
Author: User

It's been a while before you get into Gae. If you are idle, you can write code to check other people's source code. I feel like everything is familiar, at least not unfamiliar. Because datastore is not a traditional relational database, although the gql interface used is longer than the original SQL, it looks more like a brother, but it actually hides a lot of restrictions, not join is the biggest headache, so many original designs based on Relational Models must change. However, there are advantages and disadvantages. For example, adding the listproperty type can cleverly solve the design problems of many set attributes. In addition, it is the problem of debugging the program. The agile features of print + Python are enough. Now, I am staring at the output console of dev_appserver.py every day, and it is not enough agile. A long time ago, I saw an article on DW about using pydev to develop Gae. Now I have time to practice it. Take a note by the way.

Install and set pydev

You can use the Update site http://pydev.sourceforge.net/updates/ to download pydev from eclipse to convert eclipse into a python IDE. After installing pydev, You need to configure it. Open eclipse and goPreferences> pydev.

You need to inform pydev of the python installation location. GoInterpreter> PythonAnd clickNew, As shown above. You only need to browse Python v2.5 + installation, and eclipse should perform the remaining operations. ClickOKAnd then you will be ready to develop python from eclipse.

Debug your program

The Gae SDK provides command line tools for running projects locally. However, we want to use eclipse, so we need to run all the content from eclipse. This will allow us to debug the application, which we will see later. The first step to run an application is to edit the projectPYTHONPATH. The easiest way to do this is to right-click the project and selectProperties. This will open the project properties.

 

InMain moduleGo to $ app_engine_home and select the dev_appserver.py script. This is a Python application server that simulates the Gae production environment. Next, goArgumentsTab.

InProgram argumentsBox, enter${project_loc}/src. Eclipse Variables$ {Project_loc}It only points to the physical location of the current project. You need to pass the application directory to the dev_appserver.py script and then to/src. Clipse intelligently sets the default value to the run settings created earlier. You do not need to modify it, and you only need to click debug to easily debug the Gae.

Add one question: when the project is started for the second time, the error "variable references empty selection :$ {project_loc}" may be reported }",Project> clearOr "refresh the project" should be able to solve this problem.

SelectPydev-pythonpath. Then selectAdd source folderAnd navigate to the installation location of the Gae SDK. You also need to create a run configuration file to run the project. To do this, selectRun> Open RunDialog box.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.