Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

Python
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)
Posted
Updated 5-Jun-15 0:38am
v2

 
Share this answer
 
hi,
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 !!
 
Share this answer
 
v2
Thank you very much! I think now will bind python with C#
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900