Debug Pylons application through Eclipse

I have Eclipse setup with PyDev and love being able to debug my scripts/apps. I've just started playing around with Pylons and was wondering if there is a way to start up the paster server through Eclipse so I can debug my webapp?


Asked by: Marcus933 | Posted: 05-10-2021






Answer 1

Create a new launch configuration (Python Run)

Main tab

Use paster-script.py as main module (you can find it in the Scripts sub-directory in your python installation directory)

Don't forget to add the root folder of your application in the PYTHONPATH zone

Arguments Set the base directory to the root folder also.

As Program Arguments use "serve development.ini" (or whatever you use to debug your app")

Common Tab

Check allocate console and launch in background

Answered by: Dominik390 | Posted: 06-11-2021



Answer 2

If you'd rather not include your Python installation in your project's workspace to get paster, you can create a pure-Python driver like:

#!/usr/bin/env python

from paste.script.serve import ServeCommand

ServeCommand("serve").run(["development.ini"])

...and run/debug that in Eclipse.

Note: this is running without the --reload option, so you don't get hot deploys (i.e., you'll need to reload server to see changes). Alternatively, you can add the --reload option to get hot deploys, but then Pydev won't stop at your breakpoints. Can't have your cake and eat it too...

ServeCommand("serve").run(["--reload", "development.ini"])

Answered by: Elise168 | Posted: 06-11-2021



Answer 3

yanjost has it right, just wanted to add that you need to make sure you do not use the --reload option, this will prevent the debugger from properly attaching itself and cause your breakpoints not to work. Just a little thing I ran in to.

Answered by: Ada233 | Posted: 06-11-2021



Answer 4

I was able to get --reload working by changing the 'Working directory' in the arguments tab to not use default (i.e. select 'Other'->File System->'Root of your Pylons' app where development.ini is stored.

Answered by: Anna254 | Posted: 06-11-2021



Answer 5

On linux that will probably be /usr/bin/paster or /usr/local/bin/paster for paste script, and for arguments i have: serve ${workspace_loc}${project_path}/development.ini

Answered by: Miranda654 | Posted: 06-11-2021



Answer 6

I also got this working (finally). I used buildout instead of virtualenv to install pylons (instructions at: http://wiki.pylonshq.com/display/pylonscommunity/Howto+install+Pylons+with+buildout), so the instructions above needed to be changed a little as far as the paths go.

-for "Main Module", I use:

${workspace_loc:myeclipseprojectname/bin/paster}

(adding --reload made breakpoints not work for me, and I tested this a couple times)

-for "Program Arguments", I use:

serve ${workspace_loc:myeclipseprojectname/mypylonsprojectname/development.ini}

-for "Working Directory, Other:", I use:

${workspace_loc:myeclipseprojectname/mypylonsprojectname}

-as mentioned above, in "Common Tab", "Check allocate console and launch in background"

-and remember to set a breakpoint before trying.

Answered by: Eric807 | Posted: 06-11-2021



Answer 7

This doesn't really answer question about how to do it in eclipse. But I've been debugging paster server with winpdb, which is quite nice graphical python debugger (you can install it with easy_install winpdb).

Just start your server e.g.:

winpdb /usr/local/bin/paster serve development.ini

And click run button.

As wayne said, it's necessary to not use --reload option. At least I wasn't able to find how to attach to actual webapp even, when selecting to which forked process debugger should enter (entering different processes can be controlled with "fork parent" and "fork child" debugger commands).

Answered by: Walter735 | Posted: 06-11-2021



Similar questions

python - Debug uWsgi application in eclipse

I would like to debug an uWsgi application in Eclipse. Is there a way to create a run profile in Eclipse so that it can attach the debugger to the uWsgi python interpreters?


python - Debug uWsgi application in eclipse

I would like to debug an uWsgi application in Eclipse. Is there a way to create a run profile in Eclipse so that it can attach the debugger to the uWsgi python interpreters?


Usage of Eclipse DLTK parser in a stand alone application for python

I want to implement error checking rules for lint styled static analysis of simple codes (single function, about 30-100 lines) in c, cpp, java and python. The main requirement for solving this is being able to generate ASTs. I observed that the Eclipse IDE does a lot of static analysis, AST generation and processing using the plugins CDT, JDT, DLTK. I found that JDT could be used in standalone applications not requ...


python - Why won't Django 1.0 admin application work?

I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same. My problem is with the admin application. I can log into it, and view the editable models, but when I click on a model or any of the change/add but...


python - What is the best way to serve static web pages from within a Django application?

I am building a relatively simple Django application and apart from the main page where most of the dynamic parts of the application are, there are a few pages that I will need that will not be dynamic at all (About, FAQ, etc.). What is the best way to integrate these into Django, idealing still using the Djang...


networking - Embedding a remote Python shell in an application

You can embed the IPython shell inside of your application so that it launches the shell in the foreground. Is there a way to embed a telnet server in a python app so that you can telnet to a certain port and launch a remote IPython shell? Any tips for redirecting the input/output streams for IPython or how to hook it up to a telnet server library or recom...


naming - Deploying a python application with shared package

I'm thinking how to arrange a deployed python application which will have a Executable script located in /usr/bin/ which will provide a CLI to functionality implemented in A library installed to wherever the current site-packages directory is. Now, currently, I have the following directory structure in my sources: foo.py foo/ __init__.py ... which...


python - How can I capture all exceptions from a wxPython application?

I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash? Ideally I'd want to capture all output (not just errors) and log it to a file. Any unhandled exceptions ought to log to the current...


deployment - How do I deploy a Python desktop application?

I have started on a personal python application that runs on the desktop. I am using wxPython as a GUI toolkit. Should there be a demand for this type of application, I would possibly like to commercialize it. I have no knowledge of deploying "real-life" Python applications, though I have used py2exe in the past with varied success. How would I obfu...


Starting a new database driven python web application would you use a javascript widget framework? If so which framework?

I am starting a new web application project. I want to use python as I am using it at my bread-and-butter-job. However I don't want to reinvent the wheel. Some things I have thought about: AJAX would be nice if it’s not too much of a hazzle. It is best if the licensing allows commercialization but is not crucial at this point. It could also be funny to try out the G...


console application - using curses with raw_input in python

In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to move cursor / browse through the input history. Is there a simple way to get such behavior working w...


scripting - How can I launch an instance of an application using Python?

I am creating a Python script where it does a bunch of tasks and one of those tasks is to launch and open an instance of Excel. What is the ideal way of accomplishing that in my script?


Global hotkey for Python application in Gnome

I would like to assign a global hotkey to my Python application, running in Gnome. How do I do that? All I can find are two year old posts saying, well, pretty much nothing :-)






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top