跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. Ubuntu下用PyCharm 运行调试 Odoo 8.0

Ubuntu下用PyCharm 运行调试 Odoo 8.0

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
3 帖子 2 发布者 7.6k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • Y 离线
    Y 离线
    Ying Liu
    写于 最后由 编辑
    #1

    又花了一天时间在Ubuntu下用PyCharm运行 Odoo 8.0. 好看的格式在我的博客网站 [检测到链接无效,已移除]

    我试了各种功能都正常。 希望能帮助大家少走点弯路。

    [b]Run and Debug Odoo using PyCharm in Ubuntu[/b]
    11 Sep 2014
    As a beginner, being able to debug through the Odoo source code is a great learning experience. PyCharm Professional Edition is a wonderful tool to develop/debug Python applications. The following are steps to run/debug Odoo using PyCharm in Ubuntu. Though not officially stated, running Odoo in Windows is not a good idea. I started with a freshly installed Ubuntu 14.04.1 LTS desktop.

    [b]1. Update server and install tools[/b]
    Check that the Ubuntu /etc/default/locale is set to LANG="en_US.UTF-8". Then run the following to update the Ubuntu and install tools.

    sudo apt-get update
    sudo apt-get upgrade -y
    sudo apt-get install -y vim git python-pip

    [b]2. Install PostgreSQL and required packages[/b]
    sudo apt-get install -y postgresql python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-passlib

    sudo pip install gdata

    [b] 3. Start PostgreSQL and create a new role for Odoo[/b]

    In my case, I create a superuser "odoo" and set its password as "odoo".

    ```python
    # Add PostgreSQL role
    sudo -u postgres /etc/init.d/postgresql start
    sudo -u postgres psql -e --command "CREATE USER odoo WITH SUPERUSER PASSWORD 'odoo'"

    [b]4. Get Odoo 8.0 source code[/b]
    # in the directory that you want put odoo source code
    git clone -b 8.0 https://github.com/odoo/odoo.git br />
    [b]5. Create Odoo configuration file[/b]
    In Odoo project root, copy debian/openerp-server.conf to another folder. In my case, it is copied as /home/ying/dev/projects/odoo-config/openerp-server.conf , edit the file to have the following configurations:

    [options]
    ; This is the password that allows database operations:
    ; admin_passwd = admin
    db_host = localhost
    db_port = 5432
    db_user = odoo
    db_password = odoo
    addons_path = /home/ying/dev/projects/odoo/addons,/home/ying/dev/projects/odoo-connector
    In the addons_path option, set it to the addons directory in the Odoo project root. The second part is a path of a custom addon.

    [b]6. Install Java SDK[/b]
    PyCharm needs Java SDK. Download Java SDK .rpm file from Oracle's website.

    We need alien to covert RPM package to Ubuntu package. Type:
    sudo apt-get install -y alien

    To install Java SDK, type: sudo alien -i -c <path to the Java SDK RPM file>

    The installation takes a while. Once it is done, test the installation with: java -version

    [b]7. Install PyCharm Professional[/b]
    Downalod PyCharm PRofessional from JetBrains web site to the desired installation location.

    Unpack the pycharm-.tar.gz using the following command: tar xfz pycharm-.tar.gz

    Remove the pycharm-*.tar.gz to save disk space (optional).

    Run pycharm.sh from the bin subdirectory

    [b]8. Config PyCharm to run Odoo[/b]
    Then in PyCharm menu Run --> Edit Configurations, click "+" on the top left to create a new configuration with the following settings:

    Name:  odoo8
    Single instance checkbox: checked
    Script: Python 2.7.6 (usr/bin/python2.7)   
    Script parameters:    --config=--config=/home/ying/dev/projects/odoo-config/openerp-server.conf

    Congratulations, you should be able to run and debug Odoo !!!

    [b]9. Issues and solutions[/b]
    You may need to drop the newly created database if something is wrong when you run Odoo to create the initial database. There might be some garbage left in the database and you see an error message like "QWebTemplateNotFound: External ID not found in the system: web.login".

    I had this error when Odoo couldn't find Python passlib package. I installed the package, deleted the newly created database, and restarted Odoo.

    1 条回复 最后回复
    0
    • O 离线
      O 离线
      ooJerry
      写于 最后由 编辑
      #2

      好文,支持

      1 条回复 最后回复
      0

      • 登录

      • 没有帐号? 注册

      • 登录或注册以进行搜索。
      • 第一个帖子
        最后一个帖子
      0
      • 版块
      • 标签
      • 热门
      • 用户
      • 群组