diff --git a/docs/windows下运行myems-api服务 b/docs/windows下运行myems-api服务 deleted file mode 100644 index 741923b6..00000000 --- a/docs/windows下运行myems-api服务 +++ /dev/null @@ -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 \ No newline at end of file diff --git a/myems-api/README.md b/myems-api/README.md index 3143cb0a..0c5caca2 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -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/ + diff --git a/myems-api/fcntl.py b/myems-api/fcntl.py new file mode 100644 index 00000000..3791fbf6 --- /dev/null +++ b/myems-api/fcntl.py @@ -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 diff --git a/myems-api/pwd.py b/myems-api/pwd.py new file mode 100644 index 00000000..5566e132 --- /dev/null +++ b/myems-api/pwd.py @@ -0,0 +1 @@ +# left blank intentionally