我是一个项目的一部分,该项目使用protobufs在基于Python的客户端和基于c ++的服务器之间进行通信.我们也在使用CMake.
使用CMake,我正在寻找一种protoc仅在*.proto文件更改时有条件地调用程序的方法.我当前的目录结构(这似乎是问题的一部分)有一个*.proto文件目录,以及生成*.pb.{h|cc}和*_pb2.py文件的单独目录:
build/
Messages/proto/ <--- .proto files are here
Messages/cpp/ <--- would like the auto generated c++ files here
Messages/py/ <--- would like the auto generated Python files here
Server/Main.cpp
Client/Main.py
CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)
(root)CMakeLists.txt文件(下面)在执行命令protoc时运行程序build/cmake ..:
project(AAA)
MESSAGE("Protobuf autogeneration STARTED")
file(GLOB proto_packages "${AAA_SOURCE_DIR}/Messages/proto/*.proto")
execute_process(COMMAND protoc -I=${AAA_SOURCE_DIR}/Messages/proto --cpp_out=${AAA_SOURCE_DIR}/Messages/cpp/ --python_out=${AAA_SOURCE_DIR}/Messages/py/ ${proto_packages})
MESSAGE("Protobuf autogeneration COMPLETED")
cmake_minimum_required(VERSION 2.8)
find_package(Boost)
find_package(Protobuf REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${PROTOBUF_INCLUDE_DIR})
add_subdirectory(Messages/proto)
add_subdirectory(Messages/cpp)
add_subdirectory(Server)
Run Code Online (Sandbox Code Playgroud)
该Messages/proto/CMakeLists.txt文件(我不确定是否有任何影响): …
我有一个为网址'site/main /'定义的视图.我希望能够将(未经身份验证的)用户重定向到默认的"/ admin /"页面进行登录,然后在成功登录后重定向到"/ main /"页面.我按照django文档,但我必须遗漏一些东西,因为我无法让它工作.我的观点如下:
def main(request):
if not request.user.is_authenticated():
return HttpResponseRedirect('admin/?next=%s' % request.path)
else:
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
找不到页面(404)
请求方法:GET
请求URL:http:// sitename:8080/main/admin /?next =/main/
任何帮助是极大的赞赏 !