Wing IDE 创建 Django 工程

转自:http://wingware.com/doc/howtos/django


Existing Django Project

To set up a Wing IDE Professional project for an existing Django project:

  • Create a new project from the Project menu,
  • Add the Django site directory to the Wing project (so that manage.py and settings.py are both in the project),
  • Wait until the Django menu appears in the menu bar, and
  • Select the Configure Project for Django item from that menu.

This sets the Python Executable in Project Properties (if it can be located), sets up manage.py runserver --noreload 8080 as the main debug file, addsDJANGO_SITENAME and DJANGO_SETTINGS_MODULE to the environment in Project Properties, adds the site directory to the Python Path in the Wing project, ensures Django Template Debugging in Project Properties is enabled, turns on TEMPLATE_DEBUG in your site's settings.py file (debugging templates will not work without this), and sets the Default Test Framework in the Testing tab of Project Properties so that Wing's Testing tool will invoke manage.py test.

Now you should be able to start Django in Wing IDE's debugger, set breakpoints in Python code and Django templates, and reach those breakpoints in response to a browser page load.

New Django Project

If you are starting a new Django project at the same time as you are setting up your Wing IDE project:

  • Select Start Django Project from the Extensions sub-menu of the Project menu.
  • You will be prompted for the location of django_admin.py, location to place the new project, and the site name in the same entry area. Defaults for these values are based on the current project contents, if a Django project is already open.
  • Press Enter and Wing will set up a new Django project and your Wing IDE project at the same time.

This runs django_admin.py startproject , sets up settings.py to use sqlite3 default database engine, adds django.contrib.admin toINSTALLED_APPS, runs syncdb, and copies the default admin template base_site.html from your Django installation into your site's templates/admin directory.

Note that on Windows you will see an error that the superuser account could not be set up. The error includes the command that needs to be run interactively. To complete project creation, copy/paste this into a command console.

When project setup is completed, the command offers to creates a new Wing IDE project, add the files, and configure the project for use with Django as described in the Existing Django Project sub-section above.


你可能感兴趣的:(Python)