0

I create an django based app in openshift. already I want to add node.js to it.But node.js needs open port for listening :

var http = require('http');
var server = http.createServer().listen(4000);

first I decide to install node.js from here but I got error:

You can only have one framework cartridge in your application 'djangoApp'.

I search every where but I don't get the answer :(

question : is this possible to add node.js to django app and use a port to connect to node.js ?

mojibuntu
  • 307
  • 3
  • 16

2 Answers2

0

You could potentially download and untar nodejs in your ~/app-root/data directory and configure your server.js to listen on a internal port.

niharvey
  • 2,807
  • 2
  • 15
  • 24
0

Why don't make a scaleable application? That way you could maybe run a django app on one gear and node.js on another gear

TheSteve0
  • 3,530
  • 1
  • 19
  • 25
  • thanks. I need a port to use in node.js server to listen to and from it like `something.com:3999` that in html I can connect to it with `var socket = io.connect('something.com', {port: 3999});` and on the server `var server = http.createServer().listen(3999);` in your way is this possible? and one another question : can I convert my current app to scalable app without deleting it and recreate it :( ? – mojibuntu Jan 02 '14 at 06:44
  • No on the deleting and recreating - though you can use 'rhc snapshot' to help with the recreation process. We only listen on port 8000 and 8443 for inbound websocket connections. So you would use something like: var socket = io.connect('app-domain.rhcloud.com', {port: 8000}); on your html page to listen to the websockets on the node server. In terms of your JS page, you can just use the Node.js cart and look at what it does - no special mapping needed to get websockets going. – TheSteve0 Jan 02 '14 at 08:16