1. Original address: http://my.oschina.net/slhong/blog/96159
Basic description before configuration:
- Win7 +python2.7.3+postgresql9.22+ Django1.4.3
- Psycopg2-2.4.6.win32-py2.7-pg9.2.2-release
Steps to use:
- Install Python
- Installing Django
- Installing PostgreSQL9.22
- Install psycopg2-2.4.6.win32-py2.7-pg9.2.2-release, download here
- Test whether the installation was successful
Note that the main instructions here are whether the test installation was successful:
- After you install Python, open a command prompt. Enter Python and see if you can see the interactive environment of Python. If not, set the environment variables for Python.
- After you install Django, after the command is entered in Python. Enter import Django--django.version at the interactive prompt, and the input Django.verison in my own test environment will return an error, so enter the uppercase VERSION. If entered correctly, the Django version you installed will be returned.
- Since we want to test whether the database is successfully installed, we need to test it with Django to create a new project. This is the Django tutorial.
- To facilitate the description, I create a new project, the path is: D:\Pydata\mysite
- We need to create a new data in PostgreSQL before the test, and the new one is pydata.
The following is a detailed description of the test:
1. First we go through the command line prompt into our new project,
2. Use your favorite editor to open the MySite directory settings.py find databases, fill in the relevant database information, depending on your own circumstances vary. :
3. Enter python manage.py shell-->from django.db Import connection-->cursor = Connection.cursor If no error is returned indicating that the database connection was successful,
4 You can then use Django to manipulate the database ...
Django Paper link PostgreSQL database