This is just a brief tutorial I wrote for myself without the intention
of releasing, but I figure if I can help just 1 person get started,
then why keep it to myself.

Again, not to be passed off as anything more then notes I wrote one
afternoon for my own understanding on a Windows machine.

Hope this helps someone. Comments ARE welcome.

---
When creating a project you’ll want to link it to a database. So
we'll, install Python, then Django, then the database. Create the
project, setup the database, then launch the development server. For
ease we’ll go with SQLite.

Django requires Python 2.3 or higher.

Install Python. When the installation is complete, add Python to the
system path so that it can be accessed from the command prompt. To do
this access “Control Panel > System > Advanced > Environment
Variables”. Select the “path” from the “System Variables” section and
append the Python installation directory.

Download and extract Django to the “C:\”. Then in the command prompt,
“cd” to the extracted directory.

To install Django run “(Django Directory) python setup.py install” or
to manually install, copy the Django folder to the Lib > site-packages
directory inside the Python directory.

The last step to install, copy django-admin.py from “(Django
Directory) > django > bin” to either c:\ or the Python directory.
After completed you will want to test the installation by running “c:
\>python django-admin.py --version”.

Django supports many database systems like MySQL, PostgreSQL, and
SQLite. Django has a database layer, which will interact with any
supported & selected database.

Python 2.5 or later comes with the SQLite module named, “sqlite3”.
SQLite stores the database in a single file.
To use MySQL you must install the MySQL driver, which is titled
“MySQLdb”.

Django comes with its own preconfigured webserver but does support
Apache and Lighttpd.

Now, to create a new project, run “django-admin.py startproject
(project title)”.
This command will create a folder named after the project title you
entered. Inside this folder will be 4 files: __init__.py, manage.py,
settings.py and urls.py. The file functions are as follows:
i.      __init__.py: This file tells python to treat this folder as a
package.
ii.     manage.py: This is the project admin file, similar to django-
admin.py. So similar in fact they share the same code.
iii.    settings.py: The main configuration file. Includes your database
settings, site language and Django features as well as more advanced
functions.
iv.     urls.py: Configuration file. Maps the URLs with the Python
functions that handle them.

Open settings.py and set the database with “DATABASE_ENGINE”. For
SQLite enter “sqlite3”.

Next, name the database with “DATABASE_NAME”. Name it after your
project with “db” at the end. Example: “bookmarksdb”. Now save your
file.

Almost done. Cd into the project directory then tell Django to create
tables for the database with the command “python manage.py syncdb”.

Create your Superuser account. This process will create the file
titled after the database name. This file holds the application data.

Now run the development server with “python manage.py runserver”. You
can also change the default port from 8000 by appending your desired
port to the command.

Open your browser to http://127.0.0.1:8000/

Done.
---
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to