-
Notifications
You must be signed in to change notification settings - Fork 54
Home
liuyu105 edited this page Mar 19, 2017
·
3 revisions
- Python2.7
- Django1.7
你可以通过此手册完成基础环境配置
$ mkdir -p /opt/opencmdb
$ cd /opt/opencmdb && git clone https://github.com/oysterclub/open-cmdb.git
$ cd open-cmdb;
$ mkdir -p /opt/opencmdb/envs
$ virtualenv -p /usr/local/bin/python2.7 /opt/opencmdb/envs
$ source /opt/opencmdb/envs/bin/activate
$ pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
$ mysql -uroot -p
mysql> CREATE DATABASE opencmdb CHARACTER SET='utf8';
mysql> GRANT ALL PRIVILEGES ON opencmdb.* to opencmdb@127.0.0.1 IDENTIFIED BY 'opencmdb' WITH GRANT OPTION;
建议本地都配置修改local_settings,从而不影响到系统settings的配置。
$ vim /opt/opencmdb/open-cmdb/local_settings.py
LOCAL_SETTINGS = True
from base.settings import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES.update({
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'opencmdb', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': 'opencmdb', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
'OPTIONS':{'init_command': 'SET storage_engine=INNODB',
'charset': 'utf8', }
},
})
$ python ./manage.py migrate
$ python ./manage.py createsuperuser --username=admin --email=admin@example.com
$ python manage.py runserver