Django和Node进程的同一个域 [英] Django and Node processes for the same domain

查看:208
本文介绍了Django和Node进程的同一个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个进程


  1. Django和MYSQL

  2. node / express和mongo db

1。



如何将这两个过程配置为到不同的url
喜欢。 Django指向api.abc.com/v1,节点指向api.abc.com/v2?



2。



我的所有用户登录都在Django和MYSQL与OAuth之间。我可以在Django中验证用户。



但是,如何通过Django REST OAuth发送令牌来验证nodejs应用中的用户?



谢谢。

解决方案

你可以用很少的方法来做,但最方便的方法是使用像nginx这样的反向代理。 >

为您的Node应用程序配置反向代理,并为您的Django应用程序执行完全相同的操作,您可以轻松地拥有所需的路由,只需在相同的域名和端口号不同的路径。



另一个选择是从Node应用程序向Django应用程序或其他方式代理请求,但这将需要更改应用程序,而不是



以下是关于如何使用nginx,Apache甚至Microsoft IIS为Node配置反向代理的一些问题:




Hi I have two process

  1. Django and MYSQL
  2. node/express and mongo db.

1.

How can I configure this two process to point to different url like. Django point to api.abc.com/v1 and node point to api.abc.com/v2 ?

2.

all my user login is inside Django and MYSQL with OAuth. I can authenticate user in Django.

But how can authenticate user in nodejs app with the token send by Django REST OAuth ?

Thanks.

解决方案

You can do it in few ways but the most convenient method would be to use a reverse proxy like nginx.

Configuring the reverse proxy for your Node app and doing exactly the same for your Django app will let you easily have the routes that you require, on the same domain name and port number just in a different path.

Another option would be to proxy requests either from the Node app to the Django app or the other way around, but that would require changing your applications instead of just putting a proxy in front of them.

Here are some questions with onfo on how to configure reverse proxies for Node using nginx, Apache and even Microsoft IIS:

这篇关于Django和Node进程的同一个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆