Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#13691 closed (wontfix)

install instructions are unclear about creation of db tables

Reported by: webcomm Owned by: nobody
Component: Documentation Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The installation guide at doesn't tell you that you need to create database tables as part of the install (if you want to use a database). The closest it comes is when it says "If you plan to use Django’s syncdb command to automatically create database tables...". But that statement is meaningless to people who are new to Django. Unless I'm missing something, there is nothing in the instructions to tell you that creating the tables is a required step (for anyone who wants to use a database).

Change History (7)

comment:1 Changed 9 years ago by Karen Tracey don't have to create the tables. That's what syncdb does, and it's generally expected you'll use syncdb unless you have pre-existing tables that you are looking to access via Django. So manually creating the tables as part of installation of the DB is not at all the expected workflow: either you'll have them already, or you'll use syncdb to create them. Perhaps if you explained exactly what snag you ran into we'd have a better idea of how to improve the doc.

comment:2 Changed 9 years ago by webcomm

I was seeing this...

no such table: django_session

I wish I could tell you exactly when I saw that. It may be that my workflow was a little unusual, but I'm not sure.

The "Get Your Database Running" section was confusing to me. I wanted to use sqlite3, since that seems to be the easiest way to get started in the dev server and that's what I had remembered using in past experiments with Django. Under sqlite3, the instructions say "you don't need to do anything extra" but I wasn't sure what "extra" was in relation to. In fact, it turns out I didn't need to do *anything* to get the db running, in the case of sqlite3, but I don't think the instructions give that impression. The instructions seem to assume that the user knows to create a flat file to hold the db, and that beyond that there is nothing to run, per se. None of this is very explicit in the instructions.

I found installing the code pretty easy this time around. I think when I got the message about "no such table: django_session" was after running runserver.

comment:3 Changed 9 years ago by anonymous

Component: runserver

I get the same error when I did the tutorial and I am setting up / trying to access the admin page using 1.2.1 on ubuntu

comment:4 Changed 9 years ago by anonymous

forgot to add everything :)

Django version 1.2.1, using settings 'impicks.settings'
Development server is running at
Quit the server with CONTROL-C.
Traceback (most recent call last):

File "/usr/local/lib/python2.6/dist-packages/django/core/servers/", line 280, in run

self.result = application(self.environ, self.start_response)

File "/usr/local/lib/python2.6/dist-packages/django/core/servers/", line 674, in call

return self.application(environ, start_response)

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/", line 245, in call

response = middleware_method(request, response)

File "/usr/local/lib/python2.6/dist-packages/django/contrib/sessions/", line 36, in process_response

File "/usr/local/lib/python2.6/dist-packages/django/contrib/sessions/backends/", line 56, in save

session_key = self.session_key,

File "/usr/local/lib/python2.6/dist-packages/django/contrib/sessions/backends/", line 152, in _get_session_key

self._session_key = self._get_new_session_key()

File "/usr/local/lib/python2.6/dist-packages/django/contrib/sessions/backends/", line 144, in _get_new_session_key

if not self.exists(session_key):

File "/usr/local/lib/python2.6/dist-packages/django/contrib/sessions/backends/", line 29, in exists


File "/usr/local/lib/python2.6/dist-packages/django/db/models/", line 132, in get

return self.get_query_set().get(*args, kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/", line 336, in get

num = len(clone)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/", line 81, in len

self._result_cache = list(self.iterator())

File "/usr/local/lib/python2.6/dist-packages/django/db/models/", line 269, in iterator

for row in compiler.results_iter():

File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/", line 672, in results_iter

for rows in self.execute_sql(MULTI):

File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/", line 727, in execute_sql

cursor.execute(sql, params)

File "/usr/local/lib/python2.6/dist-packages/django/db/backends/", line 15, in execute

return self.cursor.execute(sql, params)

File "/usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/", line 200, in execute

return Database.Cursor.execute(self, query, params)

DatabaseError: no such table: django_session

comment:5 Changed 9 years ago by Karen Tracey

Component: runserverDocumentation

The error "no such table: django_session" implies you have not run syncdb before trying to run the server. The tutorial does include instructions to run syncdb, in this section:, after noting that the default apps included in INSTALLED_APPS each require at least one table. (django_session is used by django.contrib.sessions). This is not a bug in runserver; there might be a lack of clarity in documentation somewhere but I'm not seeing it myself since near as I can see the doc does mention exactly what needs to be done to get things running properly.

comment:6 Changed 9 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

Marking wontfix. I can't work out what area of the docs is confusing here; the tutorial is fairly clear (to my mind) about what syncdb does.

If someone can point to a specific change that needs to be made, feel free to reopen.

comment:7 Changed 8 years ago by wwinham

Just as a reference for anyone coming here with this error from google, a possible cause is the use of sqlite with a relative path for the DATABASE_NAME field. In that case, running syncdb in a different directory from where you run runserver could give you that error because you're actually using different databases. I hadn't used sqlite with django in a while, so I just ran in to that.

A full, non-relative path for the DATABASE_NAME solves this.

Last edited 8 years ago by wwinham (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top