Django Development on Windows: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:


* Python (version 2.7.3 is the latest to work with Django)
* Python (version 2.7.3 is the latest to work with Django)
* Cygwin (bash shell for Windows)
* [[Django_Development_with_IIS#BitNami_Django_Stack|Django]] — [http://bitnami.com/stack/django download link]
* Cygwin (bash shell for Windows) ''(There is a local version of the distribution)''
* [[#PyCharm|PyCharm]] IDE for Django/Python development
* [[#PyCharm|PyCharm]] IDE for Django/Python development



Revision as of 13:08, 5 April 2013

Overview

Any information relevant to doing Django development on Windows.

Software

  • Python (version 2.7.3 is the latest to work with Django)
  • Djangodownload link
  • Cygwin (bash shell for Windows) (There is a local version of the distribution)
  • PyCharm IDE for Django/Python development

IDE

PyCharm

I have been using PyCharm. There are other options, but this seems to offer a lot.

  • Can connect to databases from within the IDE.
  • Debugger.
  • Runs a server within the IDE for debugging purposes.
    Similar this command from the Django tutorial:
c:/myproject> python manage.py runserver 8080
  • Can create a Django project
    Analog to the following command from the Django tutorial:
c:/myproject> django-admin.py startproject mysite

Other IDEs

TODO: ad any notes on other IDEs as they are used or tested. Esp. any features that they offer that PyCharm does not.

A lot of people simply use vim or notepad++. But those are simply text editors, albeit with pretty-print in the case of notepad++. They don't offer debuggers or database browsers.

Debugging

PyCharm

  • Create all Django projects to be debugged from within PyCharm:
    This will create a project environment where the PyCharm debugger can run.
    • File > New Project
    • Project name: [project name]
    • Location: [d:\path\to\parent_dir] (PyCharm will match the actual project directory name to the project name.)
    • Project type: Django Project
    • Click OK
    • Enter app name and template directory in the next dialog if desired.
    • Click OK
  • Run the debugger once the code has been added.
    • Run > Debug ProjectName
    • This will start up a server running the site on `http://127.0.0.1:8080 (or whatever port is configured in the configuration).
    • Set the appropriate breakpoints.
    • Load the site in a browser to test GET requests.
    • Run curl` to test POST requests.
    • PyCharm will stop execution at the breakpoints.