#
# Django Web Project
#
# author : Hank Chan
# mail : peng2006[at]gmail.com
#
#
#
# Setp 1 : Installing the development version
#
cd /home/hank/opensource
# Check out Django's main development branch (the 'trunk') like so:
svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
# The location of the site-packages directory depends on the operating system,
# and the location in which Python was installed.
# To find out your system’s site-packages location, execute the following:
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
# make sure that the Python interpreter can load Django's code. There are various ways of accomplishing this.
# One of the most convenient, on Linux, Mac OSX or other Unix-like systems, is to use a symbolic link:
ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django
# On Unix-like systems, create a symbolic link to the file django-trunk/django/bin/django-admin.py
# in a directory on your system path, such as /usr/local/bin. For example:
ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/bin
# When you want to update your copy of the Django source code, just run the command svn update
# from within the django-trunk directory. When you do this, Subversion will automatically download any changes.
svn update
# Option, you can install mysql on debian like so:
apt-get install mysql-client-5.0 mysql-server-5.0
# Allow root to remote access mysql from anywhere
GRANT ALL ON *.* TO root@'*' IDENTIFIED BY 'XXX';
# Set password for root at first time:
mysqladmin -uroot password XXX
#
#
# Setp 2 : Implement my own Scorpion Analysis Framework
#
cd /home/hank/workspace/scorpion/web
# Creating a project
django-admin.py startproject saf
# Run the server:
# By default, the runserver command starts the development server on port 8000
# Now that the server's running, visit http://127.0.0.1:8000/ with your Web browser.
# If you want to change the server's port, pass it as a command-line argument.
# For instance, this command starts the server on port 8080:
# python manage.py runserver 8080
cd saf
python manage.py runserver
# Database setup,Editing settings.py
settings.py:
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'scorpiondb' # Or path to database file if using sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = 'XXX' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# 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.
CREATE DATABASE scorpiondb;
#Each of these applications makes use of at least one database table, though, so we need to create the tables in the #database before we can use them. To do that, run the following command:
python manage.py syncdb
# During Installing ,input like so:
Username (Leave blank to use 'hank'):
E-mail address: XXX@gmail.com
Password: XXX
#
#
# setp 3: Activate the admin site
#
# Add "django.contrib.admin" to your INSTALLED_APPS setting.
# Run python manage.py syncdb. Since you have added a new application to INSTALLED_APPS, the database tables need to be updated.
# Edit your mysite/urls.py file and uncomment the lines below the “Uncomment the next two lines...” comment.
发表于 @ 2008年12月15日 10:44:00 | 评论( loading... ) | 举报| 收藏