Python-Django-實例sadmin學習

第1章 實例sadmin


1.1 安裝sadmin

版本:python

  • [root@mydb1 sadmin]# python -V Python 2.6.6
  • pip install Django import django print(diango.get_version()) 1.6.11
  • Bootstrap v3.2.0

下載代碼: http://git.oschina.net/liufeily/sadmin git clone https://git.oschina.net/liufeily/sadmin.gitgit


將項目解壓在任意目錄下,進入項目目錄, 修改鏈接數據庫配置信息web

[root@mydb1 sadmin]# vim website/settings.py
if 'SERVER_SOFTWARE' in os.environ:
    from sae.const import (
        MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB)
else:
    MYSQL_HOST = 'localhost'
    MYSQL_PORT = '3306'
    MYSQL_USER = 'root'
    MYSQL_PASS = 'pass'
    MYSQL_DB = 'test'

同步,已經建立的數據庫test數據庫

[root@mydb1 sadmin]# python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table django_content_type
Creating table django_session
Creating table UserManage_permissionlist
Creating table UserManage_rolelist_permission
Creating table UserManage_rolelist
Creating table UserManage_user

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username: admin
Email: admin@123.com
Password:pass
Password (again):pass
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

運行項目:django

[root@mydb1 sadmin]# python manage.py runserver 0.0.0.0:80
Validating models...

0 errors found
September 23, 2015 - 16:59:03
Django version 1.6.11, using settings 'website.settings'
Starting development server at http://0.0.0.0:80/
Quit the server with CONTROL-C.

瀏覽器訪問:vim

相關文章
相關標籤/搜索