Django+Mysql的安装

1:Install Python
2:Install Django, django-admin.py startproject mysite 
3:Start the Server  python   manage.py   runserver 0.0.0.0:8000
If u got some errors like no moudle sqlite,plz recompile the python ,it may helpful
4:Setup Database Mysql
   4.1 Install Mysql Via Yum
            yum install mysql  yum install mysql-server  yum install mysql-devel
  4.2 Start Mysql 
        Add  default-character-set=utf8 to /etc/my.cnf
        service mysqld start OR /etc/init.d/mysqld start
         chkconfig -add mysqld                   
         mysqladmin -u root password 123456     Change the Password
        Forget the Password:
        service mysqld stop
        mysqld_safe --user=root --skip-grant-tables
        mysql -u root
        use mysql
        update user set password=password("new_pass") where user="root";
        flush privileges;  
5.Setup Mysql for Python
        5.1 Insatll SetupTools
              wget http://peak.telecommunity.com/dist/ez_setup.py
              python ez_setup.py
              easy_install   setuptools
        5.2 Download Mysql for Python
            python setup.py install
6.Conf Settings.py
        DATABASES = {
    'default': {
        # 'ENGINE': 'django.db.backends.sqlite3',
        # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
          'ENGINE': 'django.db.backends.mysql', 
          'NAME': 'mysql',
          'USER': 'root',
          'PASSWORD': '123456',
          'HOST': 'localhost',
          'PORT': '',
    }
}          

你可能感兴趣的:(linux,django,python,easyinstall)