added instruction for runing myems-api with waitress on Windows

pull/136/head
13621160019@163.com 2022-03-21 17:47:58 +08:00
parent 6892981249
commit b012f5d866
4 changed files with 41 additions and 19 deletions

View File

@ -1,19 +0,0 @@
1、Windows下运行myems-api服务需要安装依赖waitress命令是 pip install waitress;
2、运行服务命令waitress-serve --port=8000 app:api
3、可能遇到的问题在这卡了很久No module named 'fcntl'和No module named 'pwd'实际解决方法很简单在python目录的lib目录下新建fcntl.py和pwd.py,fcntl里内容如下pwd里空着就行
def fcntl(fd, op, arg=0):
return 0
def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""
def flock(fd, op):
return
def lockf(fd, operation, length=0, start=0, whence=0):
return

View File

@ -32,6 +32,7 @@ python-decouple
## Quick Run for Development
Quick run on Linux (NOT for production use):
```bash
cd myems/myems-api
sudo pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
@ -40,6 +41,26 @@ sudo chmod +x run.sh
./run.sh
```
Quick run on Windows (NOT for production use):
Find python path in Command Prompt:
```bash
where python
```
Assume the result is 'C:\Users\johnson\AppData\Local\Programs\Python\Python310\python.exe'
Copy fcntl.py and pwd.py to lib folder:
```bash
cp myems\myems-api\fcntl.py C:\Users\johnson\AppData\Local\Programs\Python\Python310\Lib
cp myems\myems-api\pwd.py C:\Users\johnson\AppData\Local\Programs\Python\Python310\Lib
```
Install and run with waitress:
```bash
pip install waitress
cd myems\myems-api
waitress-serve --listen=127.0.0.1:8000 app:api
```
## Installation
### Installation Option 1: Install myems-api on Docker
@ -2672,6 +2693,8 @@ curl -i -X GET {{base_url}}/reports/virtualmetercost?virtualmeterid=1&periodtype
[8]. https://foss.heptapod.net/openpyxl/et_xmlfile/
[9]. https://docs.pylonsproject.org/projects/waitress/en/latest/

17
myems-api/fcntl.py Normal file
View File

@ -0,0 +1,17 @@
def fcntl(fd, op, arg=0):
return 0
def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""
def flock(fd, op):
return
def lockf(fd, operation, length=0, start=0, whence=0):
return

1
myems-api/pwd.py Normal file
View File

@ -0,0 +1 @@
# left blank intentionally