USEFUL DJANGO COMMANDS: a) Generate new Django project: $ python "C:\Program Files\BitNami\djangostack-1.4.7-0\apps\django\django\bin\django-admin.py" startproject mysite Database setup Now, edit mysite/settings.py. It’s a normal Python module with module-level variables representing Django settings. Change the following keys in the DATABASES 'default' item to match your database connection settings. ENGINE – Either 'django.db.backends.postgresql_psycopg2', 'django.db.backends.mysql', 'django.db.backends.sqlite3' or 'django.db.backends.oracle'. Other backends are also available. NAME – The name of your database. If you’re using SQLite, the database will be a file on your computer; in that case, NAME should be the full absolute path, including filename, of that file. If the file doesn’t exist, it will automatically be created when you synchronize the database for the first time (see below). When specifying the path, always use forward slashes, even on Windows (e.g. C:/homes/user/mysite/sqlite3.db). USER – Your database username (not used for SQLite). PASSWORD – Your database password (not used for SQLite). HOST – The host your database is on. Leave this as an empty string if your database server is on the same physical machine (not used for SQLite). If you’re new to databases, we recommend simply using SQLite by setting ENGINE to 'django.db.backends.sqlite3' and NAME to the place where you’d like to store the database. SQLite is included as part of Python 2.5 and later, so you won’t need to install anything else to support your database. Note If you’re using PostgreSQL or MySQL, make sure you’ve created a database by this point. Do that with “CREATE DATABASE database_name;” within your database’s interactive prompt. If you’re using SQLite, you don’t need to create anything beforehand - the database file will be created automatically when it is needed. While you’re editing settings.py, set TIME_ZONE to your time zone. The default value is the Central time zone in the U.S. (Chicago). Also, note the INSTALLED_APPS setting toward the bottom of the file. That holds the names of all Django applications that are activated in this Django instance. Apps can be used in multiple projects, and you can package and distribute them for use by others in their projects. By default, INSTALLED_APPS contains the following apps, all of which come with Django: django.contrib.auth – An authentication system. django.contrib.contenttypes – A framework for content types. django.contrib.sessions – A session framework. django.contrib.sites – A framework for managing multiple sites with one Django installation. django.contrib.messages – A messaging framework. django.contrib.staticfiles – A framework for managing static files. These applications are included by default as a convenience for the common case. b) Initialize Django server: $ python manage.py runserver 0.0.0.0:8000 Admin can see the page from: http://127.0.0.1:8000/admin/ c) Synchronize Django databases. Necessary whenever creating a new file or modifying the database scripts: $ python manage.py syncdb d) Create a new Django app: $ python manage.py startapp e) Activate new model: Edit the settings.py file again, and change the INSTALLED_APPS setting to include the string 'appname'. So it’ll look like this: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: # 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'appname', ) Now Django knows to include the appname app. Let’s run another command: $ python manage.py sql appname f) Open de Python Shell in Console: $ python manage.py shell