当前位置: 首页 > news >正文

利用python做网站重庆旅游网站建设规划

利用python做网站,重庆旅游网站建设规划,商城网站开发技术,最近的热点新闻第一步 下载源码、更新、cmake编译#xff1a; 为了依赖的成功安装#xff0c;采用gitee进行下载与更新。记得需要安装git软件。 安装命令#xff1a; 在自己指定的目录下#xff0c;鼠标右键#xff0c;选择 git Bash Here 打开命令行 git clone -b v1.34.0 https://gi…第一步 下载源码、更新、cmake编译 为了依赖的成功安装采用gitee进行下载与更新。记得需要安装git软件。 安装命令 在自己指定的目录下鼠标右键选择 git Bash Here 打开命令行 git clone -b v1.34.0 https://gitee.com/mirrors/grpc-framework.git grpc 在grpc的目录下修改配置文件.gitmodules 复制下面内容替换.gitmodules内容 [submodule third_party/zlib]path third_party/zlib#url https://github.com/madler/zliburl https://gitee.com/mirrors/zlib.git# When using CMake to build, the zlib submodule ends up with a# generated file that makes Git consider the submodule dirty. This# state can be ignored for day-to-day development on gRPC.ignore dirty [submodule third_party/protobuf]path third_party/protobuf#url https://github.com/google/protobuf.giturl https://gitee.com/local-grpc/protobuf.git [submodule third_party/googletest]path third_party/googletest#url https://github.com/google/googletest.giturl https://gitee.com/local-grpc/googletest.git [submodule third_party/benchmark]path third_party/benchmark#url https://github.com/google/benchmarkurl https://gitee.com/mirrors/google-benchmark.git [submodule third_party/boringssl-with-bazel]path third_party/boringssl-with-bazel#url https://github.com/google/boringssl.giturl https://gitee.com/mirrors/boringssl.git [submodule third_party/re2]path third_party/re2#url https://github.com/google/re2.giturl https://gitee.com/local-grpc/re2.git [submodule third_party/cares/cares]path third_party/cares/cares#url https://github.com/c-ares/c-ares.giturl https://gitee.com/mirrors/c-ares.gitbranch cares-1_12_0 [submodule third_party/bloaty]path third_party/bloaty#url https://github.com/google/bloaty.giturl https://gitee.com/local-grpc/bloaty.git [submodule third_party/abseil-cpp]path third_party/abseil-cpp#url https://github.com/abseil/abseil-cpp.giturl https://gitee.com/mirrors/abseil-cpp.gitbranch lts_2020_02_25 [submodule third_party/envoy-api]path third_party/envoy-api#url https://github.com/envoyproxy/data-plane-api.giturl https://gitee.com/local-grpc/data-plane-api.git [submodule third_party/googleapis]path third_party/googleapis#url https://github.com/googleapis/googleapis.giturl https://gitee.com/mirrors/googleapis.git [submodule third_party/protoc-gen-validate]path third_party/protoc-gen-validate#url https://github.com/envoyproxy/protoc-gen-validate.giturl https://gitee.com/local-grpc/protoc-gen-validate.git [submodule third_party/udpa]path third_party/udpa#url https://github.com/cncf/udpa.giturl https://gitee.com/local-grpc/udpa.git [submodule third_party/libuv]path third_party/libuv#url https://github.com/libuv/libuv.giturl https://gitee.com/mirrors/libuv.git 在grpc目录下在git 上使用更新命令 cd grpc git submodule update --init 使用cmake对grpc进行编译。 编译结束后使用vs打开目录中的grpc.sln文件 右键ALL——BUILD点击重新生成。 第二步 编写 .proto 文件 新建一个C控制台项目新建 demo.proto 文件 文件内容 syntax proto3;package hello;service Greeter {rpc SayHello (HelloRequest) returns (HelloReply) {} }message HelloRequest {string message 1; }message HelloReply {string message 1; }在资源文件中右键添加现有项将demo.proto 文件添加进来。 demo.proto里面不能有中文或者utf-8的格式 第三步 生成头文件与源文件 在自己新建的控制台项目中按住Shift 右键 调处控制台 接下来我们利用grpc编译后生成的proc.exe生成proto的头文件和源文件 D:\cpp_grpc\visualpro\third_party\protobuf\Debug\protoc.exe -I. --grpc_out. --pluginprotoc-gen-grpcD:\cpp_grpc\visualpro\Debug\grpc_cpp_plugin.exe demo.proto D:\cpp_grpc\visualpro\third_party\protobuf\Debug\protoc.exe --cpp_out. demo.proto 生成出来的文件 第四步 配置VS 将这4个都右键添加现有项的方法添加到C的控制台项目中去。 开始配置VS 右键项目点击属性选择c/c,选择常规选择附加包含目录 D:\cpp_grpc\grpc\third_party\re2 D:\cpp_grpc\grpc\third_party\address_sorting\include D:\cpp_grpc\grpc\third_party\abseil-cpp D:\cpp_grpc\grpc\third_party\protobuf\src D:\cpp_grpc\grpc\include 接下来配置库路径, 在链接器常规选项下点击附加库目录添加我们需要的库目录。 右键项目点击属性选择链接器选择附加库目录 D:\cpp_grpc\visualpro\third_party\re2\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\types\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\synchronization\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\status\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\random\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\flags\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\debugging\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\container\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\hash\Debug D:\cpp_grpc\visualpro\third_party\boringssl-with-bazel\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\numeric\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\time\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\base\Debug D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\strings\Debug D:\cpp_grpc\visualpro\third_party\protobuf\Debug D:\cpp_grpc\visualpro\third_party\zlib\Debug D:\cpp_grpc\visualpro\Debug D:\cpp_grpc\visualpro\third_party\cares\cares\lib\Debug 另外我们虽然配置了库目录但还要将要使用的库链接到项目 点击链接器选择输入选项点击附加依赖项添加依赖的库名字 libprotobufd.lib gpr.lib grpc.lib grpc.lib grpc_reflection.lib address_sorting.lib ws2_32.lib cares.lib zlibstaticd.lib upb.lib ssl.lib crypto.lib absl_bad_any_cast_impl.lib absl_bad_optional_access.lib absl_bad_variant_access.lib absl_base.lib absl_city.lib absl_civil_time.lib absl_cord.lib absl_debugging_internal.lib absl_demangle_internal.lib absl_examine_stack.lib absl_exponential_biased.lib absl_failure_signal_handler.lib absl_flags.lib absl_flags_config.lib absl_flags_internal.lib absl_flags_marshalling.lib absl_flags_parse.lib absl_flags_program_name.lib absl_flags_usage.lib absl_flags_usage_internal.lib absl_graphcycles_internal.lib absl_hash.lib absl_hashtablez_sampler.lib absl_int128.lib absl_leak_check.lib absl_leak_check_disable.lib absl_log_severity.lib absl_malloc_internal.lib absl_periodic_sampler.lib absl_random_distributions.lib absl_random_internal_distribution_test_util.lib absl_random_internal_pool_urbg.lib absl_random_internal_randen.lib absl_random_internal_randen_hwaes.lib absl_random_internal_randen_hwaes_impl.lib absl_random_internal_randen_slow.lib absl_random_internal_seed_material.lib absl_random_seed_gen_exception.lib absl_random_seed_sequences.lib absl_raw_hash_set.lib absl_raw_logging_internal.lib absl_scoped_set_env.lib absl_spinlock_wait.lib absl_stacktrace.lib absl_status.lib absl_strings.lib absl_strings_internal.lib absl_str_format_internal.lib absl_symbolize.lib absl_synchronization.lib absl_throw_delegate.lib absl_time.lib absl_time_zone.lib absl_statusor.lib re2.lib 第五步 编写服务端代码 编写服务端代码 #include iostream #include memory #include string #include grpcpp/grpcpp.h #include demo.grpc.pb.h using grpc::Server; using grpc::ServerBuilder; using grpc::ServerContext; using grpc::Status; using hello::HelloRequest; using hello::HelloReply; using hello::Greeter; // Logic and data behind the servers behavior. class GreeterServiceImpl final : public Greeter::Service {Status SayHello(ServerContext* context, const HelloRequest* request,HelloReply* reply) override {std::string prefix(llfc grpc server has received : );reply-set_message(prefix request-message());return Status::OK;} }; void RunServer() {std::string server_address(127.0.0.1:50051);GreeterServiceImpl service;ServerBuilder builder;// Listen on the given address without any authentication mechanism.// 监听给定的地址builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());// Register service as the instance through which well communicate with// clients. In this case it corresponds to an *synchronous* service.builder.RegisterService(service);// Finally assemble the server.std::unique_ptrServer server(builder.BuildAndStart());std::cout Server listening on server_address std::endl;// Wait for the server to shutdown. Note that some other thread must be// responsible for shutting down the server for this call to ever return.server-Wait(); } int main(int argc, char** argv) {RunServer();return 0; } 写完使用x64平台运行一下。 第六步 编写客户端代码 右键添加新建项目grpcclient客户端 为了不重新配置一边找到当前路径 直接复制过去就完成了配置。 还要复制以下这4个文件到客户端再使用右键添加现有项将这4个添加进去。 客户端代码 #include string #include iostream #include memory #include grpcpp/grpcpp.h #include demo.grpc.pb.h using grpc::ClientContext; using grpc::Channel; using grpc::Status; using hello::HelloReply; using hello::HelloRequest; using hello::Greeter; // static method : Greeter::NewStub class FCClient { public:FCClient(std::shared_ptrChannel channel):stub_(Greeter::NewStub(channel)) {}std::string SayHello(std::string name) {ClientContext context;HelloReply reply;HelloRequest request;request.set_message(name);Status status stub_-SayHello(context, request, reply);if (status.ok()) {return reply.message();}else {return failure status.error_message();}} private:std::unique_ptrGreeter::Stub stub_; }; int main(int argc, char* argv[]) {auto channel grpc::CreateChannel(127.0.0.1:50051, grpc::InsecureChannelCredentials());FCClient client(channel);// block until get result from RPC serverstd::string result client.SayHello(hello , llfc.club !);printf(get result [%s]\n, result.c_str());return 0; } 运行效果
http://wiki.neutronadmin.com/news/359615/

相关文章:

  • 新北网站建设辽宁建设工程信息网怎么看项目经理是不是被锁住
  • 网站后台添加图片显示不了北京值得去的商场
  • 百度营销大学网站优化计划书
  • 设计工作室网站商业网站 模板
  • 网站建设项目书东莞网站建设的价格
  • 网站网页制作的公司做谷歌网站
  • 网站 pr服务网站建设方案
  • 手机软件上传网站中小企业管理软件排名
  • 网站做违法的事情投诉湖南纯手工seo电话
  • 个人网站要不要备案营销技巧心得体会
  • 珠宝首饰商城网站建设莱芜人才网招聘网
  • 萧山建设有限公司网站360极速浏览器网站开发缓存
  • 公司网站搜索引擎排名分析视觉设计和ui设计有什么区别
  • 怎么浏览国外的设计网站杭州百度快照优化公司
  • 推广方法策略与经验总结模板网站seo
  • soho需要建网站吗从色彩度讨论如何建设一个网站.
  • 个人网站经营 合法么为什么建站之前要进行网站策划
  • php网站开发专员招聘中文软件开发平台
  • 网站建设项目的结论建筑装饰公司排名
  • 怎样建个自己的网站为什么这么多人嫌弃top域名
  • 中山做网站优化免费视频网站素材
  • 网站下载下来怎么做后台线上兼职
  • 社交平台网站建设预算手机网站建站教育模板下载
  • 阿里网站建设App开发服务器租用公司
  • 果洛电子商务网站建设哪家好wordpress 置顶调用
  • 布吉网站建设哪家效益快北京确诊病例活动轨迹公布
  • 国外开源网站系统餐饮品牌设计论文
  • 福安建设网站百度医院网站建设
  • 怎么看网站后台网页尺寸免费网站设计网站
  • 广州网站制作建设做网站的流程是什么