Configure Django under Eclipse + Pydev

Source: Internet
Author: User
developing Django applications with Eclipse and Pydev

Python,eclipse,pydev and Django are installed.
Using Eclipse 3.2,pydev 1.2.4 Django 0.95 and Python 2.4

The first step, Window->preferences->preferences->pydev->python interpretter

The second step is to create a new Pydev project. And cancel the Create SRC folder option

The third step is to create a Django project from the command line, such as: startproject MySite

Step fourth, copy the code from Django to the Pydev project you just created with Eclipse, and create a src directory.

The fifth step is to refresh the project in Eclipse.

Step Sixth, right-click the project, select Pydev,pythonpath in the attribute, and add the SRC directory to the project code

When this is done, open the and press the usage message in the F9,console, and select

Run->run ..., set runserver–noreload for parameters in the Arguments option bar. ( Here are two short horizontal )

It's all done, and it's time to write Django apps.

This may be a bit of a detour: You can actually create a Django project, and then configure Runserver--noreload on it.

The tutorial environment is the latest, the previous Django development environment is the curve of saving the nation, can not directly generate Django project, in the development process will be a little inconvenience. This article uses the eclipse3.6+pydev1.6.1 and refers to the official documentation of


In order for your pydev to develop Django, you must ensure that it has been properly installed on the Python/jython/ironpython interpreter before using it, and click here for specific installation steps.

It's important to note that this tutorial will not teach you what Django does, just tell you how to properly integrate Django into the PYDEV environment, so if you don't know what Django is, go ahead and learn some tutorials about how it works ( Tip: This site has a large number of articles to introduce Django, and then look at this article, thank you. Core Content

When Django is integrated into Pydev, it is expanded around the following three configurations: The project must be marked as a Django project under Pydev. The ' django_manage_location ' string variable must point to the file under the relative path of the project. (Note: After you build the project, you will find it in the. Pydevproject in Navigation view.) The ' django_settings_module ' string variable must contain the name of the SETTINGS module under the Project project.

If you want all of Django's behavior to work Pydev, then do it. Don't worry, next I'll show you how to configure them. Create a Django project

Press CTRL + N to select the Pydev Django Project Project Wizard to create a Django based project.

The wizard will use startproject to create the project, and then it will set the property string django_manage_location the Pydev to point to the path, and let django_settings_module point to the SETTINGS module. integrated Django in general engineering

For existing projects, you simply right-click the project and choose ' Pydev > Set as Django project '.

It is important to note that thedjango_manage_location and django_settings_module variable strings are not set immediately, but Pydev prompts you to set them before you need to perform the action. Django Action

Want to know what the Django contains under Pydev, right click on the project "Django" Configuration, and choose Django > action.

Of course, you can also use the other way, is through the Pydev editor to get Focus [Note: Shortcut keys are easy to fail, please call me, thank you]: ctrl+2+dj <enter> You can open a panel containing input action history CTRL + 2+DJ Action_to_execute <enter> Show steps to perform an action (for example, CTRL+2+DJ help <enter>)

Pydev Django interacts with the shell

It is worth noting that the shell with Django environment action will create a shell property configuration in your settings that provides the Pydev shell default features such as code compilation, display history, contextual hints (ctrl+1), Build editor executable files, etc. (see the interactive platform for details).

It can be activated via the CTRL+2+DJ Shell(or Pydev editor), or right-click Engineering > Django > Shell with Django Environment.

Run/debug Django

You can run and debug a Django project (note: It defaults to setting--no-reload, otherwise there may be problems when you close the process through pydev and some processes are not killed).

This will create a default run configuration, so if you want to change a parameter, you can activate it later via run > Run configurations (or Debug > Debug Configurations).

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: 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.