Maybe something along these lines (prompt when running, after exit manage() command). It does bring up the terminal window.

# run_me.py
import os
def manage():
    s=' '
    print 'Finnish manage command by entering empty line.'
    while s<>'':
        os.chdir('d:\\Python Projects\mysite')
        s=raw_input('#')
        if s: os.system('python manage.py '+s)
manage()

or you can use instead of os.system this Command from
http://www.daniweb.com/forums/post1187140.html#post1187140

class Command(object):
    """Run a command and capture it's output string, error string and exit status"""

    def __init__(self, command):
        self.command = command 

    def run(self, shell=True):
        import subprocess as sp
        process = sp.Popen(self.command, shell = shell, stdout = sp.PIPE, stderr = sp.PIPE)
        self.pid = process.pid
        self.output, self.error = process.communicate()
        self.failed = process.returncode
        return self

    @property
    def returncode(self):
        return self.failed

On Windows OS this behaves like double-clicking on the Python code file name ...

import os
os.startfile("manage.py")

I was thinking of something along the lines of Oracles ability to run SQL scripts from the SQL*Plus command line, like so:

SQL> start  script.sql  param1  param2

I guess what I'm asking is, if the Python command interpreter (and thereby PythonWin and IDLE) can do this:

>>> manage.py  syncdb

Edited 6 Years Ago by Soren Werk: n/a

The more primitive solution:

# run_me.py
import os
def manage(s): os.system('python manage.py '+s)

## let's keep it working not only in windows

manage('syncdb')
## after running this file you can use manage-command from IDLE command window
## but output goes to separate terminal window
This article has been dead for over six months. Start a new discussion instead.