Running manage.py commands in Windows Power Shell

1,920 views
Skip to first unread message

orschiro

unread,
Mar 14, 2012, 1:35:59 PM3/14/12
to Django users
Hello,

I have a question which is based on the discussion here:

http://groups.google.com/group/django-users/browse_thread/thread/2333f5dc8d0674f0

I'm working on Windows 7 with the PowerShell. Python 2.7 and the path
to django-admin.py is stored in my PATH variable.

After creating a project I can make use of the various manage.py
commands in my PowerShell. However, only in the following way:

'python manage.py runserver'

If I only type '.\manage.py runserver' then a new CMD window is opened
running again 'python manage.py runserver'. That is, the command is
forwarded to the CMD shell which opens it with the Python
interpreter.

Is there any way to tell the PowerShell to interpret the command given
within the shell instead of launching a CMD window?

Regards,

Robert

Tom Evans

unread,
Mar 14, 2012, 1:51:02 PM3/14/12
to django...@googlegroups.com

You might also want to ask on a powershell or windows forum.

Whilst you are trying to do stuff with django, you're looking for
python users who run windows (most don't) and use powershell instead
of python to write scripts. I'd imagine that is a very small subset,
particularly on this list.

Cheers

Tom

orschiro

unread,
Mar 14, 2012, 2:53:02 PM3/14/12
to Django users
Hello Tom,

I'm aware of that. But do not get me wrong. I only use Power Shell to
run the commands, for nothing more.

it is simply more comfortable for me than CMD.

By running Python on Windows you mean the Python IDLE?

Regards

On Mar 14, 6:51 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, Mar 14, 2012 at 5:35 PM, orschiro <orsch...@googlemail.com> wrote:
> > Hello,
>
> > I have a question which is based on the discussion here:
>
> >http://groups.google.com/group/django-users/browse_thread/thread/2333...

Tom Evans

unread,
Mar 15, 2012, 5:42:29 AM3/15/12
to django...@googlegroups.com
On Wed, Mar 14, 2012 at 6:53 PM, orschiro <orsc...@googlemail.com> wrote:
> Hello Tom,
>
> I'm aware of that. But do not get me wrong. I only use Power Shell to
> run the commands, for nothing more.
>
> it is simply more comfortable for me than CMD.
>
> By running Python on Windows you mean the Python IDLE?
>
> Regards
>

No, I meant that you will not get much help with launching python
applications via powershell here, because the people on this list are
django developers, and in general do not use powershell.

Cheers

Tom

Sam Lai

unread,
Mar 15, 2012, 5:54:47 AM3/15/12
to django...@googlegroups.com

For me, both ways execute within PowerShell's shell. I do have
ActiveState ActivePython installed instead of the Python distribution
from python.org though; I find the ActiveState distribution integrates
much better with Windows than python.org's.

That said, I can't really explain why you're seeing what you're seeing
though. Does it happen if you just do '.\test.py' where test.py just
contains simple Python commands like a couple of print statements?

> Regards,
>
> Robert
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

orschiro

unread,
Mar 18, 2012, 5:14:15 AM3/18/12
to Django users
Hello Sam,

Let's assume we're having the following script test.py containing
nothing more than a print statement and a raw_input.

====
print "Test"
raw_input()
====

When I launch test.py in PowerShell like that:

PS C:\Users\Robert> .\test.py

Then C:\Python27\python.exe is launched in a new cmd window that runs
test.py.

When I launch test.py in PowerShell like that:

PS C:\Users\Robert> python test.py

Then the script is launched inside PowerShell. Exactly this should
happen also when I only type .\test.py.

Is this the case for the ActivePython package?

Regards,

Robert

On Mar 15, 10:54 am, Sam Lai <samuel....@gmail.com> wrote:
> On 15 March 2012 04:35, orschiro <orsch...@googlemail.com> wrote:
>
>
>
>
>
>
>
>
>
> > Hello,
>
> > I have a question which is based on the discussion here:
>
> >http://groups.google.com/group/django-users/browse_thread/thread/2333...

orschiro

unread,
Mar 19, 2012, 6:37:34 AM3/19/12
to Django users
After testing the Python distribution of ActiveState I have to confirm
that with that version I smoothly can run .\test.py in PowerShell
without having the cmd window to pop up.

Overall I can only recommend all Windows users to prefer this one over
the default one.

Regards
Message has been deleted

Jani Tiainen

unread,
Mar 19, 2012, 1:17:00 PM3/19/12
to django...@googlegroups.com
Hi,

I (and all my other teammates) are have been developing in windows with standard Python (+ Django + lot of other interesting stuff) in WinXP, Vista, Win7.

To keep everyone on same line, we use TCC/LE (Take Command Console/LE) which is augmented CMD. Has lot of nice features. And it's free.

On Sun, Mar 18, 2012 at 6:32 PM, Dennis Lee Bieber <wlf...@ix.netcom.com> wrote:
On Sun, 18 Mar 2012 02:14:15 -0700 (PDT), orschiro
<orsc...@googlemail.com> declaimed the following in
gmane.comp.python.django.user:


> Is this the case for the ActivePython package?

       Since I don't have a non-ActiveState install anywhere to compare
against...

-=-=-=-=-=-
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS E:\UserData\Wulfraed\My Documents> ./test.py
test

PS E:\UserData\Wulfraed\My Documents> python test.py
test

PS E:\UserData\Wulfraed\My Documents> .\test.py
test

PS E:\UserData\Wulfraed\My Documents>

PS E:\UserData\Wulfraed\My Documents> get-host


Name             : ConsoleHost
Version          : 2.0
InstanceId       : 253c9466-5541-4737-b974-5b376fd39caa
UI               :
System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace



PS E:\UserData\Wulfraed\My Documents>
-=-=-=-=-=-

WinXP (on which I had to download PowerShell as it isn't standard),
running from a semi-privileged (so-called "power user") account.
--
       Wulfraed                 Dennis Lee Bieber         AF6VN
       wlf...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply all
Reply to author
Forward
0 new messages