第1章 实例sadmin
1.1 安装sadmin
版本:
- [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.git
将项目解压在任意目录下,进入项目目录, 修改连接数据库配置信息
[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)
运行项目:
[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.
浏览器访问: