Sunday, March 21, 2010

Django on Pydev

The current nightly build (which will be 1.5.6) is already providing some special support for Django (special thanks to Leo Soto for providing a good base for building upon).

There are still some details until the final release, but I'd like to get some feedback before that.

The special support goes in the following:

1. Create a 'Pydev Django' project (will use django to create a manage.py, settings.py and urls.py)

2. For an existing project, just right click it and choose 'Pydev > Set as Django project)'

3. Custom Django actions can be accessed right clicking a project with the Django config and choosing Django > action.

4. Note that the Shell with django environment will create a shell properly configured with your settings, providing the default features from the pydev shell, such as code completion, history, context assistants (ctrl+1), etc (see: http://pydev.org/manual_adv_interactive_console.html for more details)

5. Run as Django/Debug as Django are available (note that they set the --no-reload by default, otherwise the debugger may have some issues and other processes may be kept alive when closing the process spawned by Pydev).

And that's it. It's all there in the nightly build already (I still have some features and minor adjustments to do, but that should already give a good idea of what will be available, and I'm waiting for feedback to know if there's something missing that really should be there).

16 comments:

I usually have some problems with the definitions of the Django modules and names in PyDev, probably because it doesn't detect propperly all the Django modules, and end with some "false errors" on the projects. Are you improving this issue? I know Django makes some dynamic loading, so maybe it's difficult.

Also, what I miss is some support (syntax and autocompletion) with the templates. It will be great to help with that, too..

I use PyDev almost every day and I think it's really great tool! I want to add a "good job" statement to the message ;-)

Feature request right off the bat - since you are doing a right-click menu for various manage commands (and it's great to have most common ones up top) - how about adding "Other" submenu which will dynamically load up, essentially, the output of "manage.py help" and provide one-click access to numerous other manage.py commands, particularly custom ones added by developers.

Hi, is there any way round the "--noreload" restriction? For me one of the killer features of Django is being able to edit the code, then just reload the page to see my changes. Having to stop and restart the server all the time is a pain - I'll just stick to running it from the command line in that case.

Yes, you can edit the run configuration that was created when you did a run as django (under run > run configurations > pydev django > choose the run configuration > remove --noreload from the arguments tab).

Note that doing that will prevent you from using the debugging properly, in which case you have to use the remote debugger. See: http://pydev.org/manual_adv_remote_debugger.html )