Skip to main content

xy_web_service web服务模块

Project description

xy_web_server

说明

xy-web-service服务模块.

源码仓库

安装

# bash
pip install xy_web_server

使用

# bash
xy_web_server -c project -n xy_web_server_demo
# 创建项目 [ xy_web_server_demo ] 成功!!!
# 项目路径 ==>>> /mnt/bs-media/Workspace/project/opensource/xy-web-service/xy_web_server/test/xy_web_server_demo

cd xy_web_server_demo
xy_web_server
# >>>>>>>>>>>> xy_web_server_demo - v1.0.1 <<<<<<<<<<<<<
#
# xy_web_server_demo Hello World!!!

提示: 运行Tornado与Django web服务请参考 案例

Web服务开发

1. 创建项目

# bash
xy_web_server -c project -n xy_web_server_demo
# 创建项目 [ xy_web_server_demo ] 成功!!!
# 项目路径 ==>>> /mnt/bs-media/Workspace/project/opensource/xy-web-service/xy_web_server/test/xy_web_server_demo

cd xy_web_server_demo
xy_web_server
# >>>>>>>>>>>> xy_web_server_demo - v1.0.1 <<<<<<<<<<<<<
#
# xy_web_server_demo Hello World!!!

2. 接入Django服务和Django-ORM, Tornado

具体请参考 Runner.py

1. 加载Django设置

注意: 加载Django要在引入Tornado的RequestHandler早, 这样才能够在Tornado的RequestHandler中调用Django的模型

# Runner.py
admin_path = Path.cwd().joinpath("source/Runner/Admin/").resolve().as_posix()
sys.path.insert(0, admin_path)
# 若需要使用Django-orm调用该函数
Django().load("xy_web_server_demo.settings")

2. 接入manage.py管理

Runner.py 文件中的django_manage方法等同于

# bash
# ./samples/xy_web_server_demo/source/Runner/Admin/manage.py
python manage.py 后续参数...

例如:

# bash
xy_web_server -w django shell
#相当于

cd xy_web_server_demo/source/Runner/Admin

python manage.py shell

#############################################################################
# 同步数据表, 在每次启动服务之前需要同步数据表
xy_web_server -w django makemigrations
xy_web_server -w django migrate

3. 启动Django服务

注意: 后台用户名: root 密码: 1

Runner.py 文件中的 django_start 方法等同于

# bash
# ./samples/xy_web_server_demo/source/Runner/Admin/manage.py
python manage.py runserver 127.0.0.1:8401

例如:

# bash
xy_web_server -w django start
#相当于

cd xy_web_server_demo/source/Runner/Admin

python manage.py runserver 127.0.0.1:8401

4. 启动Tornado服务

Runner.py 文件中的 tornado_start 方法

# bash
xy_web_server -w tornado start

许可证

xy_web_server 根据 <木兰宽松许可证, 第2版> 获得许可。有关详细信息,请参阅 LICENSE 文件。

捐赠

如果小伙伴们觉得这些工具还不错的话,能否请咱喝一杯咖啡呢?

Pay-Total

联系方式

微信: yuyangiit
邮箱: yuyangit.0515@qq.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xy_web_server-1.0.3.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

xy_web_server-1.0.3-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file xy_web_server-1.0.3.tar.gz.

File metadata

  • Download URL: xy_web_server-1.0.3.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for xy_web_server-1.0.3.tar.gz
Algorithm Hash digest
SHA256 603550bce478a0ba946b3b1d64cb6ffef7eda454cb4c12f8849bdb71bfc3d01b
MD5 55944513a478d85bd075030ec0f30a7b
BLAKE2b-256 d98bec1cdc0dd26d029d32774ba347f154276c477e75048cd745a6dc44d8744f

See more details on using hashes here.

File details

Details for the file xy_web_server-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for xy_web_server-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1fddb30a4f9891742a80d555ba15b6642abd99549e8ceca8ccadfc7fabe1744
MD5 9c7f6f8f9e5b6a4e68a6b7361e7fb811
BLAKE2b-256 3dcc36008075358a2c4a90728dcc9193e0ccf0739d270b7d52480d2f73eabd07

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page