Saturday, December 31, 2011

Re: django-admin.py startproject will NOT work.

On Dec 31, 6:18 pm, Bart Nagel <b...@tremby.net> wrote:
> At 2011-12-31 15:01:39 -0800, Chris Kavanagh wrote:
>
>
>
>
>
>
>
>
>
> > On Dec 31, 11:58 am, Bart Nagel <b...@tremby.net> wrote:
> > > What about other Python programs? Do they have the same problem?
>
> > > Put this next paragraph in a file and run it with different numbers of
> > > arguments and see what happens.
>
> > > import sys
> > > print "%d arguments" % len(sys.argv)
>
> > > Save it as args.py
>
> > > Run
> > > python args.py
> > > python args.py arg1
> > > python args.py arg1 arg2
>
> > As far as other programs, I'm not sure. I'm not a programmer (just
> > learned Python over the last few months) so I haven't tried any other
> > programs yet.
>
> > Ok, so save the paragraph in a file, then run the commands from the
> > command line EXACTLY as you have them? In other words, from command
> > line, type in Python args.py, then python args.py arg1, and python
> > args.py arg 2??
>
> > Forgive my ignorance, working from the command line with this stuff is
> > new to me. And I've never understood exactly what command line args
> > are. . .But I'm learning.
>
> The command line is the dream, you'll come to love it. Well, maybe not
> the Windows one.
>
> I guess first up just run
>     python
> and see if you get the interactive Python shell. Or maybe you need
>     python.exe
> since you're on Windows? Anyway, if you get the shell, the python
> executable is in your path and works to at least some extent. If you
> don't get the shell, and you get "command not found" or something (I
> don't have a Windows box so I don't know exactly what it would look
> like) you may need to use the full path to the executable, as people
> before have suggested.
>
> So those two lines ("import..." and "print...") make a very simple
> Python script which just outputs the number of arguments it thinks it
> was given.
>
> Invoke the script with Python just as you're meant to do for the
> Django script. On linux I just run
>     python args.py
> and it tells me "1 arguments". If I run
>     python args.py something
> it tells me "2 arguments" and so on.
>
> What behaviour do you get?
>
> The point of this is that if this python script can see the arguments
> then I can see absolutely no reason why your django-admin.py script
> would not see them, and I would be stumped.
>
> --bart

Ok, I CAN start the Python Interpreter from the command line by just
typing "python" then "enter".

I saved the file "args.py" in the Python Scripts folder. When I try to
run it from command prompt, I get the message "python: can't open
file 'args.py': [Errno 2] No such file or directory".

The only way I CAN get it to open, is to change (cd into) into the
python scripts folder (where I saved args.py) then run it (type
"python args.py" in command prompt). So, obviously something is wrong.

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

Re: django-admin.py startproject will NOT work.

At 2011-12-31 15:01:39 -0800, Chris Kavanagh wrote:
> On Dec 31, 11:58 am, Bart Nagel <b...@tremby.net> wrote:
> > What about other Python programs? Do they have the same problem?
> >
> > Put this next paragraph in a file and run it with different numbers of
> > arguments and see what happens.
> >
> > import sys
> > print "%d arguments" % len(sys.argv)
> >
> > Save it as args.py
> >
> > Run
> >     python args.py
> >     python args.py arg1
> >     python args.py arg1 arg2
>
> As far as other programs, I'm not sure. I'm not a programmer (just
> learned Python over the last few months) so I haven't tried any other
> programs yet.
>
> Ok, so save the paragraph in a file, then run the commands from the
> command line EXACTLY as you have them? In other words, from command
> line, type in Python args.py, then python args.py arg1, and python
> args.py arg 2??
>
> Forgive my ignorance, working from the command line with this stuff is
> new to me. And I've never understood exactly what command line args
> are. . .But I'm learning.

The command line is the dream, you'll come to love it. Well, maybe not
the Windows one.

I guess first up just run
python
and see if you get the interactive Python shell. Or maybe you need
python.exe
since you're on Windows? Anyway, if you get the shell, the python
executable is in your path and works to at least some extent. If you
don't get the shell, and you get "command not found" or something (I
don't have a Windows box so I don't know exactly what it would look
like) you may need to use the full path to the executable, as people
before have suggested.

So those two lines ("import..." and "print...") make a very simple
Python script which just outputs the number of arguments it thinks it
was given.

Invoke the script with Python just as you're meant to do for the
Django script. On linux I just run
python args.py
and it tells me "1 arguments". If I run
python args.py something
it tells me "2 arguments" and so on.

What behaviour do you get?

The point of this is that if this python script can see the arguments
then I can see absolutely no reason why your django-admin.py script
would not see them, and I would be stumped.

--bart

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

Re: django-admin.py startproject will NOT work.

On Dec 31, 12:38 pm, Ramiro Morales <cra...@gmail.com> wrote:
> On Fri, Dec 30, 2011 at 4:04 PM, Chris Kavanagh <cka...@gmail.com> wrote:
>
> >>   C:\python27\python C:\path\to\django-admin startproject foo
>
> >> or, if you have C:\python27 in the PATH, simply:
>
> >>   python C:\path\to\django-admin startproject foo
>
> > Thanks for the reply, however it didn't work. I get the exact same
> > thing: "Usage: django-admin.py subcommand [options] [args]" with
> > options below for help.
>
> Try both, I think both of them should work.
>
> BUT, that isn't the important part. The important part is abut you should
> make sure you execute it with the Python interpreter.
>
> Forget about trying to simple invoke django-admin (or django-admin.py)
> as a standalone program.
>
> Good luck.
>
> --
> Ramiro Morales

Thanks Ramiro. . .I don't think you saw my other reply to your
original post about trying this. . .

I'll ask again. I'm not sure exactly what path to use, when you say
\path\to. The directory I created is called "mysite" & it's path is C:
\mysite\.I started a command prompt from "mysite" then typed "python
django-admin.py startproject mysite" in the command prompt (didn't
work).

Forgive my ignorance, is this what you wanted me to try??

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

Re: django-admin.py startproject will NOT work.

On Dec 31, 11:58 am, Bart Nagel <b...@tremby.net> wrote:
> At 2011-12-31 19:47:35 +0300, Timothy Makobu wrote:
>
> > File associations are fine i reckon, because django-admin is giving you the
> > help message because for some reason it thinks you're *giving it improper
> > input*.
>
> What about other Python programs? Do they have the same problem?
>
> Put this next paragraph in a file and run it with different numbers of
> arguments and see what happens.
>
> import sys
> print "%d arguments" % len(sys.argv)
>
> Save it as args.py
>
> Run
>     python args.py
>     python args.py arg1
>     python args.py arg1 arg2

As far as other programs, I'm not sure. I'm not a programmer (just
learned Python over the last few months) so I haven't tried any other
programs yet.

Ok, so save the paragraph in a file, then run the commands from the
command line EXACTLY as you have them? In other words, from command
line, type in Python args.py, then python args.py arg1, and python
args.py arg 2??

Forgive my ignorance, working from the command line with this stuff is
new to me. And I've never understood exactly what command line args
are. . .But I'm learning.

And THANK YOU ALL FOR THE HELP!!!

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

Re: django-admin.py startproject will NOT work.

On Dec 31, 11:47 am, Timothy Makobu <makobu.mwambir...@gmail.com>
wrote:
> Hi,
>
> File associations are fine i reckon, because django-admin is giving you the
> help message because for some reason it thinks you're *giving it improper
> input*.
>
>So, you're saying you don't believe this is the problem (File Associations)?? I don't think it is either, but I thought it was worth a try. It was in a Stack Overflow question about Python (Windows) not accepting command line args.

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

Re: django-admin.py startproject will NOT work.

On Dec 31, 12:13 pm, Andre Terra <andrete...@gmail.com> wrote:
> This has been answered before:
>
> http://groups.google.com/group/django-users/browse_thread/thread/9d53...
>
> Cheers,
> AT
>
>
> Yes, I saw that thread, and I tried changing my registry as suggested. And the other 'work around'. Neither worked.
>
>
>
>

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

USStateField default value

I wanted to have a select box for the state with California as the
default. I first tried in my model the following:

state = USStateField(blank=True, default='CA')

This gave me the error "TypeError: __init__() got an unexpected
keyword argument 'default'".

But the following works (i.e., California is the default and I have a
nice select box):

state = models.CharField(blank=True, max_length=2,
choices=STATE_CHOICES, default='CA')

Could this be a bug? I am using 1.3.

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