V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Jays
V2EX  ›  问与答

Ghost+MySQL 到底要怎么设置呢? 各位指点下

  •  
  •   Jays · 2014-12-13 00:23:05 +08:00 · 3176 次点击
    这是一个创建于 3633 天前的主题,其中的信息可能已经有所发展或是发生改变。
    配置文件如下:

    // # Ghost Configuration
    // Setup your Ghost install for various environments
    // Documentation can be found at http://support.ghost.org/config/

    var path = require('path'),
    config;

    config = {
    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
    url: 'http://localhost',
    mail: {},
    client: 'mysql',
    connection: {
    host : '127.0.0.1',
    user : 'root', //我们暂且用 MySQL 的 root 账户
    password : '111111', //输入你的 MySQL 密码
    database : 'ghost', //我们前面为 Ghost 创建的数据库名称
    charset : 'utf8'
    },
    debug: false
    },

    server: {
    // Host to be passed to node's `net.Server#listen()`
    host: '127.0.0.1',
    // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
    port: '2368'
    }
    },

    // ### Development **(default)**
    development: {
    // The url to use when providing links to the site, E.g. in RSS and email.
    // Change this to your Ghost blogs published URL.
    url: 'http://localhost:2368',

    // Example mail config
    // Visit http://support.ghost.org/mail for instructions
    // ```
    // mail: {
    // transport: 'SMTP',
    // options: {
    // service: 'Mailgun',
    // auth: {
    // user: '', // mailgun username
    // pass: '' // mailgun password
    // }
    // }
    // },
    // ```

    database: {
    client: 'mysql',
    connection: {
    host : '127.0.0.1',
    user : 'root', //我们暂且用 MySQL 的 root 账户
    password : '111111', //输入你的 MySQL 密码
    database : 'ghost', //我们前面为 Ghost 创建的数据库名称
    charset : 'utf8'
    },
    debug: false
    },
    server: {
    // Host to be passed to node's `net.Server#listen()`
    host: '127.0.0.1',
    // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
    port: '2368'
    },
    paths: {
    contentPath: path.join(__dirname, '/content/')
    }
    },

    // **Developers only need to edit below here**

    // ### Testing
    // Used when developing Ghost to run tests and check the health of Ghost
    // Uses a different port number
    testing: {
    url: 'http://127.0.0.1:2369',
    database: {
    client: 'sqlite3',
    connection: {
    filename: path.join(__dirname, '/content/data/ghost-test.db')
    }
    },
    server: {
    host: '127.0.0.1',
    port: '2369'
    },
    logging: false
    },

    // ### Testing MySQL
    // Used by Travis - Automated testing run through GitHub
    'testing-mysql': {
    url: 'http://127.0.0.1:2369',
    database: {
    client: 'mysql',
    connection: {
    host : '127.0.0.1',
    user : 'root',
    password : '',
    database : 'ghost_testing',
    charset : 'utf8'
    }
    },
    server: {
    host: '127.0.0.1',
    port: '2369'
    },
    logging: false
    },

    // ### Testing pg
    // Used by Travis - Automated testing run through GitHub
    'testing-pg': {
    url: 'http://127.0.0.1:2369',
    database: {
    client: 'pg',
    connection: {
    host : '127.0.0.1',
    user : 'postgres',
    password : '',
    database : 'ghost_testing',
    charset : 'utf8'
    }
    },
    server: {
    host: '127.0.0.1',
    port: '2369'
    },
    logging: false
    }
    };

    // Export config
    module.exports = config;



    npm start 后提示

    > [email protected] start /www/web/ghost
    > node index

    ERROR: Ghost is unable to start due to missing dependencies:
    Cannot find module 'bcryptjs'
    Cannot find module 'bluebird'
    Cannot find module 'body-parser'
    Cannot find module 'bookshelf'
    Cannot find module 'busboy'
    Cannot find module 'cheerio'
    Cannot find module 'colors'
    Cannot find module 'compression'
    Cannot find module 'connect-slashes'
    Cannot find module 'downsize'
    Cannot find module 'express'
    Cannot find module 'express-hbs'
    Cannot find module 'fs-extra'
    Cannot find module 'html-to-text'
    Cannot find module 'knex'
    Cannot find module 'lodash'
    Cannot find module 'moment'
    Cannot find module 'morgan'
    Cannot find module 'node-uuid'
    Cannot find module 'nodemailer'
    Cannot find module 'oauth2orize'
    Cannot find module 'passport'
    Cannot find module 'passport-http-bearer'
    Cannot find module 'passport-oauth2-client-password'
    Cannot find module 'request'
    Cannot find module 'rss'
    Cannot find module 'semver'
    Cannot find module 'showdown-ghost'
    Cannot find module 'sqlite3'
    Cannot find module 'unidecode'
    Cannot find module 'validator'
    Cannot find module 'xml'
    Cannot find module 'qiniu'
    Cannot find module 'upyun'
    Cannot find module 'aliyun-sdk'

    Please run `npm install --production` and try starting Ghost again.
    Help and documentation can be found at http://support.ghost.org.


    npm install --production 运行后还是使用SQLite3
    2 条回复    2014-12-13 09:59:40 +08:00
    Lesilva
        1
    Lesilva  
       2014-12-13 06:03:14 +08:00
    database: {
    client: 'mysql',
    connection: {
    host : '127.0.0.1',
    user : 'your_database_user',
    password : 'your_database_password',
    database : 'ghost_db',
    charset : 'utf8'
    }
    }

    要改Production里面的 你改成Development的设置了
    Jays
        2
    Jays  
    OP
       2014-12-13 09:59:40 +08:00 via Android
    @Lesilva Production也是mysql的配置
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2641 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 05:31 · PVG 13:31 · LAX 21:31 · JFK 00:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.