Configuring python and django

  
on your own machine

django's introductory book has been read the second time, and the environment is still awkward. The last time I saw a little confidence in the database, this encounter is high. I just want to stick to it. The good memory is not as bad as the bad one, let alone I am still a bad memory. Or a solid record.
Developing a web project with python I chose the django framework, how to make python and Django runs on my own machine? We step by step: (PS: window has installed mysql database, python2.5.4 version, django1.02 version.)

Environmental building

First we download these files: python2.5.4 django1.02 mysql-python

python2.5.4 and mysql-python are executable files, just install it (of course python first). After completion In order to facilitate the use of our configuration environment variables, add the python directory path to the path variable (cite).
Set python and django environment variables

Now we need to install django. Will be downloaded Unzip the archive to any directory:
django extract to any directory

Open the command prompt (cmd), enter the directory. And type the command as shown below:

python setup.py install install django

After the carriage return is executed, you will see the process of installing django. After the completion, you can delete the extracted directory.

You also need to add django-admin.py to the environment variable, as shown above. The first picture is shown.
So we will install django.

How to get started

The environment is not doing anything, but it doesn’t really have much sense of accomplishment. Let's take a sense of accomplishment, create a new project with django and run it up:

First we open cmd, locate the directory where you want to create a new project, any directory can be. Then type the following command:
< PRE>django-admin.py startproject hello

where hello is the name of the new project directory file. After confirming the implementation, django creates a new project for us. The hello folder contains the django framework related files and default configuration files. Don't care about its details first.

Next we will locate the path of cmd to the hello directory. The following command:

python manage.py runserver

You will see the following output:
Django server successfully opened

Open the browser, visit: http://127.0. 0.1:8000/. Haha~ We succeeded It worked!

This server is just a test lightweight server built into django and can't be used in production environment.

Copyright © Windows knowledge All Rights Reserved