[PySide] PySide plus Django: How can I make the PySide application auto-start the server?

Zak pyside at m.allo.ws
Tue Aug 28 21:29:51 CEST 2012


Dear PySide People,

I am making a PySide application for Windows 7. One important portion of 
my application is a Django web app. Currently, to start my application, 
you do the following:

# First, we need to start the Django web server.

1. Open a terminal ("Command Prompt" on Windows).

2. At the terminal:

cd /path/to/server/

python manage.py runserver

# Now the server is running.

# Next, we need to start the PySide GUI.

3. Double-click the file pts_qt.py

# The contents of the file pts_qt.py are attached to this email.

# pts_qt.py is very simple (for the purposes of asking this question), 
it just opens a Qt GUI window, fills it with a QWebKit browser, and 
points the browser at http://127.0.0.1:8000/, which is the URL of the 
website being served by Django.

As you can see, starting my application requires 3 steps. I want it to 
be just one step. That step should be "Double-click the file pts_qt.py", 
and that should start the Django webserver automatically.

It would also be nice if closing the Qt GUI by clicking the "X" in the 
corner of the window would stop the Django server too.

How can I make pts_qt.py start the Django server automatically? Note 
that the Django server should start its own terminal window (Command 
Prompt window) which prints status messages and stuff.

Thank you,

Zak

P.S. You might be asking, "Why is this a PySide app and not just a web 
app?" Well, the actual application is more complicated. It comes in 
three flavors:

A. Pure Web App, to be used remotely and with nothing but a browser.

B. Remote Thick Client. This is a PySide app that interacts with the 
remote web server, but also does special non-web stuff, like interfacing 
with hardware.

C. Pure Local Client. This is a PySide app that is like the Remote Thick 
Client, except that it doesn't connect to the mothership server. It 
starts its own Django server. This is the thing we are trying to fix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pts_qt.py
Type: text/x-python-script
Size: 332 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120828/8c2c8356/attachment.bin>


More information about the PySide mailing list