Newbie sqlite3 dbshell confusion

29 views
Skip to first unread message

bobhaugen

unread,
Jan 31, 2008, 11:27:42 AM1/31/08
to Django users
Installed the latest Django package from the Synaptic package manager
on Ubuntu 7.10. I understand the Django version to be 0.96.1 (package
says 0.96-1ubuntu0.1).

I'm on the first django tutorial:
http://www.djangoproject.com/documentation/tutorial01/

Got my sqlite database set up. Now trying to "run the command-line
client for your database".

I understand the way to do that is $ python manage.py dbshell

I get an error message saying "No such file or directory".

Googling for this situation, I find http://code.djangoproject.com/ticket/6338
Which says I need to Sqlite3.

But I thought sqlite3 came along with Python 2.5. No?

Any clues to what am I missing here? Need to install something else?
Path problems?
Generic newbiness?

Thanks,
Bob Haugen

Eduardo - IdNotFound

unread,
Jan 31, 2008, 11:33:44 AM1/31/08
to django...@googlegroups.com
Hello,

> But I thought sqlite3 came along with Python 2.5. No?
>
> Any clues to what am I missing here? Need to install something else?
> Path problems?
> Generic newbiness?

I don't think so. Anyway, it is as simple as installing package
"sqlite3" on your Ubuntu. If it's already there, even better.

You might also need the "python-sqlite2" package, which provide the
Python bindings for SQLite 3 (yeah, the version numbers look confusing
at first). I'm not sure how Django works with SQLite, but those are
the steps I took when installing Trac (I use Django with MySQL).
Shouldn't be much different, as both are written in Python.


Hope it helps,
Eduardo.

Jeff Anderson

unread,
Jan 31, 2008, 11:38:25 AM1/31/08
to django...@googlegroups.com
Hello,

An unrelated note to your question...
If you are using 0.96, you need to use the 0.96 docs.
http://www.djangoproject.com/documentation/0.96/

The link you pasted assumes you are using the development version, which
has some differences. My personal recommendation is to remove 0.96 and
use django-svn.

Just thought I'd let you know!

Jeff Anderson

> --~--~---------~--~----~------------~-------~--~----~
> 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
> -~----------~----~----~----~------~----~------~--~---
>
>


signature.asc

bobhaugen

unread,
Jan 31, 2008, 2:24:26 PM1/31/08
to Django users
On Jan 31, 10:38 am, Jeff Anderson <jeffe...@programmerq.net> wrote:
> The link you pasted assumes you are using the development version, which
> has some differences. My personal recommendation is to remove 0.96 and
> use django-svn.

You are correct. I just tried some of the tutorial steps that
determine if I have the latest version, and I don't.

Followup question: I understand some adjustments were made to the
ubuntu package to make it run better on ubuntu.

Does anybody know what those are, and what I wd need to do to recreate
them if I uninstalled 0.96.1 (which at least seems to work) and
installed django-svn?

Ramiro Morales

unread,
Jan 31, 2008, 2:41:27 PM1/31/08
to django...@googlegroups.com

What you have installed is the SQLite library and the Python bindings, both
pieces come now included in Python 2.5 (if you were using an older
Python version you would have to install Ubunto packages named libsqlite3
and python-sqlite3 or similar).

But what dbshell does is to execute tue command line client
for your backend (mysql for MySQL, etc,...) aleady configured
to work with the database of your Django project, and for
SQLite that command line client application is sqlite3
that in Debian/Ubuntu comes in the sqlite3 package:

http://packages.ubuntu.com/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords=sqlite3

Note the "A command line interface for SQLite 3" part. Install it
using the package management tool of the distribution
and try again.

Regards,

--
Ramiro Morales

bobhaugen

unread,
Feb 1, 2008, 7:03:53 AM2/1/08
to Django users
On Jan 31, 10:38 am, Jeff Anderson <jeffe...@programmerq.net> wrote:
> My personal recommendation is to remove 0.96 and
> use django-svn.

Ok, I did that. Or tried to do that, anyway.

1. Removed 0.96.1.
2. did: svn co http://code.djangoproject.com/svn/django/trunk/ django-
trunk
3. did: sudo ln -s /django-trunk/django /usr/lib/python2.5/site-
packages/django
4. did: sudo ln -s /django-trunk/django/bin/django-admin.py /usr/local/
bin
5. started python interpreter
6, typed: import django
got error message: ImportError: No module named django

I also noticed that svn put django-trunk under my home directory -
that's not where 0.96.1 was installed by the package manager.

And the django symlinks in site-packages and /usr/local/bin say they
are broken.

So where did I go wrong?

Brett Parker

unread,
Feb 1, 2008, 7:22:37 AM2/1/08
to django...@googlegroups.com

The 0.96 package there is just the one from Debian, the only changes
that are made to the debian package is that django-admin.py becomes
django-admin as it's installed in to /usr/bin (django-admin.py is still
in /usr/lib/python-django/bin, along with the other django scripts).

(Except the version in hardy, which rewrites the shebang of manage.py
when manage.py is created - which we used to have in the debian
packages, but removed as using the system default python is the correct
behaviour as a default, and if you're not using the default then you
already know enough to run manage.py in the interpreter of your choice).

There are svn snapshot packages available from the debian experimental
repository, with some pinning you should be able to pull in that and
only that from the experimental repository. The latest snapshot was
r7047 (thanks Gustavo).

Thanks,
--
Brett Parker

bobhaugen

unread,
Feb 1, 2008, 8:33:02 AM2/1/08
to Django users
Brett,

Thanks for the info on the Ubuntu 0.96 package. I really appreciate
the replies from you, Jeff and Ramiro. Sorry to be so clueless, I'm
new to Linux and Python as well as Django. (I know it's a bad idea to
adopt more than one new technology at a time, but I got no choice,
gotta plunge in...)

On Feb 1, 6:22 am, Brett Parker <iDu...@sommitrealweird.co.uk> wrote:
> There are svn snapshot packages available from the debian experimental
> repository, with some pinning you should be able to pull in that and
> only that from the experimental repository. The latest snapshot was
> r7047 (thanks Gustavo).

Will that be any better for running on Ubuntu than
http://code.djangoproject.com/svn/django/trunk/ , which I am currently
trying to get installed so it will work? (See previous message in this
thread http://groups.google.com/group/django-users/msg/43d4e4774b935cf8
).

Brett Parker

unread,
Feb 1, 2008, 8:45:27 AM2/1/08
to django...@googlegroups.com

Better is subjective! It's just a snapshot of the svn trunk at rev
7074... it should be fairly easy to install though, and it'd get dropped
in to site-packages for all python versions installed. However, I've
just glanced at the version of python-support in gutsy and it appears to
be older than the version that package relies on...

If you're just wanting to run the latest trunk then you can just use an
svn checkout and add that in to PYTHONPATH on the command line (you
might also want to add <checkout>/bin to your PATH to get
django-admin.py there).

I haven't currently got an upto date ubuntu system about, but I could
build packages for the current svn when I get home if that would be of
use...

Thanks,
--
Brett Parker

bobhaugen

unread,
Feb 1, 2008, 11:00:10 AM2/1/08
to Django users
Thanks again, Brett.

On Feb 1, 7:45 am, Brett Parker <iDu...@sommitrealweird.co.uk> wrote:
> If you're just wanting to run the latest trunk then you can just use an
> svn checkout and add that in to PYTHONPATH on the command line (you
> might also want to add <checkout>/bin to your PATH to get
> django-admin.py there).

I appended django-trunk and django-trunk/django/bin to sys,path in the
Python interpreter and I can now import django with no errors.

I did a bunch of googling for PYTHONPATH but am still confused about
how to add things to it. Clues welcome, but if I just go trial and
error am I likely to cause any damage?

> I haven't currently got an upto date ubuntu system about, but I could
> build packages for the current svn when I get home if that would be of
> use...

That's a generous offer, but I hope to be able to get the svn checkout
working. The sys.path additions suggest it is possible.

Brett Parker

unread,
Feb 1, 2008, 12:09:29 PM2/1/08
to django...@googlegroups.com
On 01 Feb 08:00, bobhaugen wrote:
>
> Thanks again, Brett.
>
> On Feb 1, 7:45 am, Brett Parker <iDu...@sommitrealweird.co.uk> wrote:
> > If you're just wanting to run the latest trunk then you can just use an
> > svn checkout and add that in to PYTHONPATH on the command line (you
> > might also want to add <checkout>/bin to your PATH to get
> > django-admin.py there).
>
> I appended django-trunk and django-trunk/django/bin to sys,path in the
> Python interpreter and I can now import django with no errors.
>
> I did a bunch of googling for PYTHONPATH but am still confused about
> how to add things to it. Clues welcome, but if I just go trial and
> error am I likely to cause any damage?

PYTHONPATH is just an environmental variable, often if you're not
already using it it'll be empty ;) You can check it's current value
with:
echo $PYTHONPATH

If it's empty then you can just do:
export PYTHONPATH=/path/to/django/trunk/checkout

Otherwise:
export PYTHONPATH=$PYTHONPATH:/path/to/django/trunk/checkout

That should give you enough to be able to run the development server
etc... For apache2 and mod_python you can just add it in the
PythonPath.

Hope that helps,
--
Brett Parker

bobhaugen

unread,
Feb 1, 2008, 12:58:07 PM2/1/08
to Django users
Thanks again for your patience, Brett. That at least got me to the
point where import django works.

If I run into other problems down the road, I'll start another
thread. We're way off topic in this one, altho I'm happy with the
results so far.

Eduardo - IdNotFound

unread,
Feb 1, 2008, 9:28:16 PM2/1/08
to django...@googlegroups.com

Always use absolute paths when creating symbolic links. Sounds like it
should be something similar to "sudo ln -s
/home/YOUR_USER/django-trunk/django
/usr/lib/python2.5/site-packages/django" for you.

This should make the import wrok.


Hope it helps,
Eduardo.

Reply all
Reply to author
Forward
0 new messages