Code

Opened 17 months ago

Closed 16 months ago

Last modified 16 months ago

#19279 closed Cleanup/optimization (fixed)

Order of database setup and Django install unclear

Reported by: colinnkeenan@… Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: timograham@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the detailed installation instructions docs.djangoproject.com/en/dev/topics/install/ it says

If you plan to use Django's manage.py syncdb command to automatically create
database tables for your models, you'll need to ensure that Django has
permission to create and alter tables in the database you're using; if you
plan to manually create the tables, you can simply grant Django SELECT,
INSERT, UPDATE and DELETE permissions. On some databases, Django will need
ALTER TABLE privileges during syncdb but won't issue ALTER TABLE statements
on a table once syncdb has created it.

And, this paragraph comes before the steps to install the Django framework. Because of this, I asked a question on stackoverflow about how I would go about setting up PostgreSQL to give Django the right permissions. I had already installed PostgreSQL, got the server running, created a role that had the necessary permissions, and went through a tutorial in the PostgreSQL manual. But, although I knew how to create roles in general, I didn't know what specific role Django might expect to have been created for it or how to tell Django to use PostgreSQL. The paragraph I quoted above made it seem to me that this needed to be done before I installed the Django framework. I was thinking otherwise the installation wouldn't be done properly and it wouldn't use PostgreSQL or wouldn't have the right permissions.

The way to fix this so others don't have this confusion is to add a little more to that paragraph explaining:

1) Install the Django framework first.
2) For each Django project, make sure there's a user/role defined in the database that has the permissions Django would need.
3) Specify the user/role in the Django's settings.py. More on that is in Django tutorial

Attachments (1)

19279.diff (1.7 KB) - added by timo 16 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 17 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 16 months ago by timo

comment:2 Changed 16 months ago by timo

  • Cc timograham@… added
  • Has patch set
  • Summary changed from docs.djangoproject.com/en/dev/topics/install/ "you'll need to ensure that Django has permission to create and alter tables in the database you're using" makes it seem like there's more to do with the database before installing Django framework to Order of database setup and Django install unclear
  • Type changed from Bug to Cleanup/optimization
  • Version changed from 1.4 to master

How does the attached patch look?

comment:3 Changed 16 months ago by colinkeenan

You've inserted a phrase about first installing Django and creating a project near the beginning of the paragraph and a sentence about settings at the end of the paragraph.
Looks good to me: I don't think I would've been confused if I had read the proposed patch when first installing Django.
Thanks.

comment:4 Changed 16 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 72a6ac568d28afdfa5be6bcb01526adb03eedfae:

Fixed #19279 - Clarified order of database setup and Django install.

Thanks colinnkeenan for the suggestion.

comment:5 Changed 16 months ago by Tim Graham <timograham@…>

In 528483cae22fa89f46a48a7d20d50f2880fb3bf7:

[1.5.X] Fixed #19279 - Clarified order of database setup and Django install.

Thanks colinnkeenan for the suggestion.

Backport of 72a6ac568d from master

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.