Installation: Edit settings

  1. Create a project
  2. Installation

Your project has a file called “settings.py”. You need to change a few things there, mainly the name and location of the database you’re using.

Your DATABASE_ENGINE should be “sqlite3”. Your DATABASE_NAME should be “Blog.sqlite3”.

DATABASE_ENGINE = 'sqlite3'

DATABASE_NAME = 'Blog.sqlite3'

You’ll also need to tell Django what time zone you’re in:

TIME_ZONE = 'America/Los_Angeles'

Django comes with a wonderful administration tool for SQL databases, but you need to enable it. Head down to the bottom of settings.py and look for INSTALLED_APPS. Duplicate the last line inside the parentheses (it probably says “django.contrib.sites”) and change the new line to “django.contrib.admin”.

INSTALLED_APPS = (

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.sites',

'django.contrib.admin',

)

Go to the command line and type “python manage.py syncdb” inside your Blog project folder. This will create your database file. You’ll need to set up a superuser username, password, and e-mail. Remember your password!

If you look in your Blog project folder, you’ll see Blog.sqlite3; this is your SQLite database file.

Finally, open “urls.py” and remove the hash mark (comment) in front of the lines with the comment about enabling the admin:

from django.contrib import admin

admin.autodiscover()

(r'^admin/', include(admin.site.urls)),

Go to “http://localhost:8000/admin/” in your browser, and you should now see the basic administrative page for the built-in user databases.

  1. Create a project
  2. Installation