I am writing a Python based application (CLI Back End) which does telnet to some network components and gets some data. It saves the data in SQLite db.
For this application I am writing Django based frond end. Which will start the CLI app and monitor it. For communication between the CLI App and Django I am not able to decide what to use. I read somewhere on net that Django channels can be used in this problem.
I have no idea about what Django channel is and what it does. I need to come up with a tool for this CLI and Django communication.
Related
I use Django Channels for WebSocket, but I can't find a way to deploy it on Windows. I can't change my platform so switching to Linux is not an option.
Could you please suggest a way to deploy Django Channels on Linux?
Or Do you know what is the Django Channels alternative for Windows?
Django channels also implement with redis server. redis server available on window.
use Django Channel Layer with redis server.
channel layer use web-socket between Django application and socket layer.
please follow this link Channel-Layers
Every tutorial and guide show I need another framework such as Express, Angular, Sails, or Koa to connect with MongoDB.
Do I need to learn how to write Middleware, Adapters, and more to get MongoDB to work with EmberJS?
I'm pretty new, and I just finished a simple to-do and web scraping apps. I want to learn how to store it like how I can just write python script, process data, connect to postgresql, save data to the database server.
Can you provide a link to the right source, a step by step process, or tools to research that can help anyone in my position now and in the future learn how to make EmberJS and MongoDB work together without going in circles?
I use nodejs, emberjs, mongodb hosted on heroku.
I'm using django as backend. While reading stuff about meteor, i found django-ddp.
I searched a lot, but I didn't get what django-ddp is for.
I understood that you can use it to connect meteor to your django backend, but what is the use case?
How does the client connect to django and/or meteor? Does meteor have to run on the same server? How are the http requests handled?
Maybe a tiny example would help me to get this.
For me important: Can i use this to combine benefits of django and meteor?
Django DDP provides a Meteor compatible, realtime, latency compensated backend framework for Django (Python) models. It can also serve your Meteor frontend code (HTML/JS/CSS/...) allowing you to avoid using Meteor (and node.js) on the server, whilst serving regular Django views at the same time.
Django is a respected web framework with a powerful object relational mapper (ORM), with support for schema migrations included by default. Django DDP is efficient and secure, using gevent to handle HTTP requests and manage concurrency at the process level, and multiple processes (across multiple hosts) to allow scaling-out to serve many clients simultaneously. WebSockets are handled using gevent-websocket. Combining these aspects with the realtime, latency compensated benefits of Meteor does indeed give you the advantages of both (unless you prefer to run node.js on your backend servers).
If Django DDP is used to serve your Meteor app then the client (browser) will connect to Django DDP automatically. Otherwise, you can connect your Meteor app to Django DDP and use the Django DDP connection like this:
if(Meteor.isClient) {
Django = DDP.connect('http://ddp.example.com/');
Tasks = new Mongo.Collection('myapp.Tasks', {connection: Django});
Django.subscribe('Tasks', {
onReady: function(error, result) {
// Log each matching Task to the browser console in a table
console.table(Tasks.find().fetch());
}
});
}
If you're serving your Meteor app from Django DDP then drop the DDP.connect line and omit the second parameter to new Mongo.Collection.
You might find the Todos example app a useful place to start. It includes a full working example of how to write both the Meteor client app and the Django DDP server app.
Disclaimer: I'm the author of Django DDP - sorry if parts of my answer sound like marketing guff but I'm just trying to answer the first part of the question.
I'm currently working on a project which would require some realtime functionalities such as Multi-user chatrooms etc.
Ideally, I’m looking to have meteor run the chat application(on a different port) and mongodb act as message broker to the django back-end which would take care of user registration , management and everything 'non-realtime' related.
This would involve setting up a reverse-proxy which would redirect to a different port based on the url (please let me know if i'm wrong in this)
Would this be possible(or even advisable)? Another option would be to implement the same with tornado. but I have no experience with building tornado-based apps and rather do this with a framework I’m comfortable with.
Thanks,
You can have Django serve the Meteor front-end while providing access to its data using django-ddp, giving you some distinct advantages:
Continue to serve your existing Django project/apps.
No extra services or ports to manage.
Scale out by simply adding more front-end Python/Django servers (server to server IPC is done via the existing database connection).
Use django.contrib.auth user accounts in your Meteor app.
Familiar Python/Django code (no "callback" style such as with Tornado).
Use time-tested, trusted relational databases.
Use Django migrations to effectively manage schema changes.
There's a Gitter chat room where I can give you assistance if you need it.
DISCLAIMER: I'm the author of django-ddp.
A meteor application is more than capable of handling the user registration flow and many other things. Why not just build the application entirely in meteor? Your application sounds like a perfect candidate for meteor, with realtime interaction with your database at the core.
The other option would be to use swampdragon which adds realtime data binding within django. It allows for simple bi directional communication between the server and the client. Again, essential for a chat application. It nice and easy to get setup and running as well.
Are there any specific reasons to not implementing your application in one framework alone?
For a brief overview/desciption, I am using Django as the bread and butter for a webapp. I want to add a bunch of "real-time" features to the app. More so then I can do with stuff like Torndao or django-socketio. So what I would like to do is take the full dive and use Django with node.js. Basically, Django will get all the data and and handle all the accounts. Then when a piece of data changes, it will send a message using AMQP which will route the message to node.js. Node.js will then use socket.io to get the fresh data to the browser.
My question is how to get the two to play together. Specifically, how can I get both on the same domain so that when the client connects to
var socket = io.connect('http://thedomain.com');
it will be dealt with by node.js and all the other requests will go to Django? Also, I would ideally like to have the Django app running on Heroku as a standalone app and have the node.js also running on Heorku on the standalone app, if possible. Any tips or pointers would be greatly appreciated! Thanks!