On Wed, 2006-08-02 at 20:11 -0700, Dan Shafer wrote:
> Thanks for the note, Malcolm. I remain stymied.
> 
> On 8/2/06, Malcolm Tredinnick <[EMAIL PROTECTED] > wrote:
>         
>         
>         If you want to work with an interactive prompt, the easiest
>         way is to be 
>         inside your project directory (jobs/ in your case, I guess)
>         and run
>         "./manage.py shell". This will set up DJANGO_SETTINGS_MODULE
>         and append
>         the current directory to the Python path for you.
> 
> I did this. I tried it in the /jobs directory and in its parent
> directory /djproject. No luck in either case. In neither case to I get
> an error message, so I assume it runs, but I still get an error
> indicating there is no module called jobs.models.

In one of your directories (is it djproject?) you will have the
manage.py script that "django-admin.py startproject ..." created. That
is your "project" directory, for the sake of clear communication.
Underneath that you will typically have directories that contain
applications (any maybe other directories for other purposes, but they
are not relevant here).

So, in you project directory, you run "manage.py shell", get a Python
prompt and then "from jobs.models import Job" does not work? Is that
what you are saying?

Check that your jobs directory has an __init__.py file, since that could
cause the error you are seeing if it is missing. Can you run "import
jobs" without an error? If not, then "import jobs.models" is doomed to
failure, so find the simplest case that fails and fix that first.

Can you run "from jobs import models"?

Inside the interactive shell ("manage.py shell"), what is the value of
sys.path? It should contain your project directory.

Is jobs.models a file in your case (jobs/models.py) or a directory
containing other files (jobs/models/Job.py)?

What I'm really probing for here is confirmation that you have followed
that tutorial (at [1]) precisely and not started improvising as you go
along. :-)

[1] http://www-128.ibm.com/developerworks/linux/library/l-django/

A couple of other things...

I'm a little bit concerned that your original mail said you set up the
project under django/bin/. I'm hoping you didn't mean inside the source
directory. It would be more logical to have it somewhere well away from
the source (say, your home directory) so that if you update the source
you don't damage any project development you have done.

Note quite sure what problems you were having with the PYTHONPATH, etc.
Basically, the test of whether things are working is, again, at the
interactive prompt somewhere well away from the site-packages/
directory, does "import django" work. If so, you're set. If not, you
have to tweak things until that works. I'm not sure how install
locations on a Mac work or if the egg generated by Django makes sense
(since I don't use eggs), so others on the list will have to help you
with that portion. But it would be helpful if you could at least test
the "import django" bit (and examine what "sys.path" tells you if
"import django" fails).

> BTW, you said, "If you want to work with an interactive prompt." I'm
> actually not as comfortable with the interactive prompt as I'd like to
> be but as far as I can tell from reading both of the tutorials I'm
> trying to figure out, I don't have a choice. At least none is
> mentioned. All the Python learning i've done has been basically in
> IDLE. 

IDLE is essentially just an interactive prompt wrapped in a window. It's
the same thing, just the standard prompt appears in a terminal. So don't
worry about that too much. You don't get some of the fancier features
like typing into a file and then running that directly with the standard
shell, but hopefully that isn't too hard to work around for simple
tutorial purposes.

Are there some particular difficulties you are having?

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to