请问如何将C#连接到python,或将C ++连接到python [英] Please how to connect C# to python, or C++ to python
问题描述
您好!我可以问你一个问题吗?我在服务器Django上有Ubuntu,用于url-address的Python编写的用户身份验证(lokalhost:port / admin)。我在C#WPF中有一个客户端,你能告诉我如何结合C#或Python +(似乎需要编写你的API Django,或者有一种方法可以更容易地实现它)。
或者您需要联系C ++(使用python库),然后绑定到C#。问题:需要使用C#对Django进行身份验证。
Hello! Can I ask you a question? I have Ubuntu on the server Django, Python-written user authentication for url-address (lokalhost:port/admin). And I have a client in C # WPF, could you tell me how to combine C # or Python + (there seems to need to write your API Django, or is there a way how to implement it easier).
Or you need to contact with C++ (with a library of python), and then bind to the C #. Question: need to with C# to authenticate to Django.
def login(request):
username = request.POST.get('username', '')
password = request.POST.get('password', '')
user = auth.authenticate(username=username, password=password)
if user is not None:
auth.login(request, user)
return HttpResponseRedirect('/books')
else:
message = "User or password wrong"
return HttpResponseRedirect('/log', message)
推荐答案
参见 https://docs.python.org/2/extending/extending.html [ ^ ]。
hi,
2方法可以在这里找到,例如:two-ways-run-python-programs-c [ ^ ]
这是一篇内容丰富的Codeproject文章:Python,Visual Studio和C#......所以。甜蜜。 [ ^ ]
希望这有帮助!!
2 approaches can be found here with example: two-ways-run-python-programs-c[^]
Also a very informative Codeproject article at : Python, Visual Studio, and C#… So. Sweet.[^]
hope this helps !!
非常感谢!我想现在将使用C#
Thank you very much! I think now will bind python with C#
这篇关于请问如何将C#连接到python,或将C ++连接到python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!