Getting Started with Python development and combat 8-Java-based integrated development environment

Source: Internet
Author: User

8. Java-based integrated development environment for Python

All of our code and examples so far have been implemented through the Notepad text editor, which is less efficient in real-world project development (except for prawns) and often improves coding efficiency with IDE's integrated development environment. In this chapter we will briefly describe the two main integrated development environments.

8.1. Download and install the Java Runtime Environment

http://www.java.com/zh_CN/download/manual.jsp

Install the Java Runtime Environment according to the operating system version download, such as:

8.2.Eclipse IDE

http://www.eclipse.org/downloads/

Choose to download the Eclipse Standard 4.4 version and unpack the package to the following:

D:\Develop Tools\eclipse folder.

8.3. Install the Eclipse Python plugin

Run Eclipse on the menu bar select Help->install New software appears as follows:

Click the Add button and the interface appears as follows:

URLs for PyDev as Eclipse plugin

Python plugin Address: http://pydev.org/updates

In the pop-up box

Name:

Location:http://pydev.org/updates

Click OKto install the Python plugin

8.4. Configuring the Eclipse Python development environment

If you click on "Quick Auto-config", the IDE will automatically detect the Python2.7 operating environment we installed earlier.

Results such as:

8.5. Use the Eclipse IDE to develop the Python project 8.5.1. Create a new MySite project with the IDE

First, select Create a new other project, and in the pop-up box, choose a Pydev Django project, (Remember to rename the original MySite directory to mysite_manual) such as:

After clicking the Finish button to create the project, we can see our project in the development environment, such as:

The IDE environment adds. Project and. pydevproject files, which are IDE integrated environment files added by the IDE environment in order to manage the program structure. The directory structure is as follows:

mysite/ . Project Pydevproject manage.py mysite/ __init__. py wsgi.py settings.py ur ls.py

Open the mysite/settings.py file we will find the IDE environment to see how easy it is to write code.

8.5.2. Migrating the inventory of the MySite project we created manually

First, we add apps to the auto-created MySite, such as:

We add an app inventory to the project, and the code is expanded as it was created manually, such as:

The next thing we do is to copy the files from the manually created inventory directory, and the IDE creates a directory that refreshes the structure that the IDE will see, such as:

We're similarly reconfiguring the app we need to load in settings.py.

Installed_apps = ('Django.contrib.auth','Django.contrib.contenttypes','django.contrib.sessions','django.contrib.sites','django.contrib.messages','Django.contrib.staticfiles',#uncomment the next line to enable the admin:#' Django.contrib.admin ',#uncomment the next line to enable admin documentation:#' Django.contrib.admindocs ','Inventory')

Finally, because we re-created the new database mydb when we created the project, now we re-create the database table with the SYNCDB command.

The execution effect is the same as the cmd command prompt, just as the IDE environment console is displayed, and we connect the database with the database tools to see the newly created table.

8.5.3. Reconfigure the urls.py of the MySite project
Urlpatterns = Patterns ("',#Examples:#URL (r ' ^$ ', ' mysite.views.home ', name= ' home '),#URL (r ' ^mysite/', include (' Mysite.foo.urls ')),#Uncomment the Admin/doc line below to enable admin documentation:#URL (r ' ^admin/doc/', include (' Django.contrib.admindocs.urls ')),#uncomment the next line to enable the admin:#URL (r ' ^admin/', include (Admin.site.urls)), URL (r'^addinstockbill/$', views. addinstockbill), url (r'^additem/$', views. AddItem), url (r'^success/$'  , views.success), )

8.5.4. Now let's run our project in the IDE.

On the right-click Project menu, select the 1.PyDev Django from the Run as command, and we'll see our program running in the console form.

Browser Open http://127.0.0.1:8000, now see our well-written URLs, the migration work is done.

8.6. Summary

I have been the main use of the integrated development environment over the years is Microsoft's VS series, so at first not quite adapted to the eclipse environment, but familiar with a few days after the should also launch. The actual project development integrated development environment is very important, so you need to quickly familiarize yourself with a mainstream integrated development environment as your own development tool!

Getting Started with Python development and combat 8-Java-based integrated development environment

Related Article

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.