您的位置:首页 > 编程语言 > Python开发

Python-Django-实例sadmin学习

2015-09-23 17:26 901 查看

第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[/code] 
将项目解压在任意目录下,进入项目目录, 修改连接数据库配置信息

[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.


浏览器访问:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Python Django sadmin