Odoo 部署windows server 2012

需要安装前置补丁#

clearcompressionflag.exe、KB2919442、KB2919355、KB2932046、KB2959977、KB2937592、KB2938439、KB2934018。

使用odoo14官网安装包#

地址:https://www.odoo.com/zh_CN/page/download

NSSM运行Nginx#

下载新版的nginx-window http://nginx.org/en/download.html

系统找不到nssm则切到odoo安装目录下nssm\x64或\86下运行

注册服务 路径为nginx.exe的路径
nssm install Nginx "D:\Program Files\Odoo 14.0.20210710\nginx-1.21.3\nginx.exe"
运行服务
nssm start Nginx
停止服务
nssm stop Nginx
移除服务
nssm remove Nginx

nignx.conf配置文件

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#user  nobody;
worker_processes  1;
 
error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
#pid        logs/nginx.pid;
 
 
events {
    worker_connections  1024;
}
 
 
http {
    include       mime.types;
    default_type  application/octet-stream;
 
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    access_log  logs/access.log  main;
 
    sendfile        on;
    #tcp_nopush     on;
 
    keepalive_timeout  1800;
 
    gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
    gzip on;
 
    upstream odoo {
        server 127.0.0.1:8069 fail_timeout=3000s;
    }
    upstream odoopoll {
        server 127.0.0.1:8072 fail_timeout=3000s;
    }
 
    server {
        listen       80;
        server_name  localhost;
        charset utf-8;
        access_log off;
 
        location / {
            proxy_pass http://odoo;
 
            client_body_timeout 1200s;
            proxy_connect_timeout 1200s;
            proxy_send_timeout 1200s;
            proxy_read_timeout 1200s;
            proxy_redirect    off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Forwarded-Host $server_name;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
 
        location /longpolling/ {
            proxy_set_header Host $host:8072;
            proxy_pass http://odoopoll/longpolling/;
            proxy_redirect    off;
            proxy_set_header  X-Real-IP        $remote_addr;
            proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_connect_timeout 3600s;
            proxy_read_timeout 3600s;
            proxy_send_timeout 3600s;
            send_timeout 3600;
 
         }
 
        location ~* /[0-9a-zA-Z_]*/static/ {
            proxy_cache_valid       200 60m;
            proxy_buffering         on;
            expires                 864000;
            proxy_pass              http://odoo;
        }
        client_header_buffer_size 512k;
        large_client_header_buffers 4 512k;
    }
 
}

  

 

NSSM重启odoo#

nssm restart odoo-server-14.0

问题汇总#

安装后 localhost:8069无法显示此页,且server/odoo.log 中出现odoo.service.server: Initiating shutdown

原因:#

创建项目是创建数据库连接时用户名/密码进行自定义, 造成的odoo连接不上数据库导致的初始化失败
代码运行时报错提示ValueError : embeddednullbyte

解决:#

找到 项目文件夹/python/Lib/_strptime.py 文件,在文件的最前面部分,找到如下内容,追加一行

locale.setlocale(locale.LC_ALL,'en')

后重启项目

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Strptime-related classes and functions.
 
CLASSES:
    LocaleTime -- Discovers and stores locale-specific time information
    TimeRE -- Creates regexes for pattern matching a string of text containing
                time information
 
FUNCTIONS:
    _getlang -- Figure out what language is being used for the locale
    strptime -- Calculates the time struct represented by the passed-in string
 
"""
import time
import locale
import calendar
from re import compile as re_compile
from re import IGNORECASE
from re import escape as re_escape
from datetime import (date as datetime_date,
                      timedelta as datetime_timedelta,
                      timezone as datetime_timezone)
try:
    from _thread import allocate_lock as _thread_allocate_lock
except ImportError:
    from _dummy_thread import allocate_lock as _thread_allocate_lock
 
# 追加一行
locale.setlocale(locale.LC_ALL,'en')
 
__all__ = []

  

 

posted @   CrossPython  阅读(157)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
历史上的今天:
2019-03-10 Python Selenium element is not reachable by keyboard
2019-03-10 python selenium chrome有界面与无界面模式
点击右上角即可分享
微信分享提示