Using Django for communication between APIS? - python

I am new in the world of programming. I know a little python and I am learning Django. I understand that Django is very useful for webpages backend.
But I don't just want a website or an webapp. What I want is to centralize all the operations of my company by communicating through APIS different applications such as CRM (customer relationship management), SQL database, bulk mail software, etc.
For example, I want that when I perform an action in my CRM software (sales), it activates a scrapy script that I am creating, which scrapes certain pages, and then stores information in my SQL database.
Can I centralize all of this through Django as if it were a central base that connects all my scripts and the communications between APIs?

Yes. I would try doing any POST request to your Django server. In this code try doing a POST request to any other server. This should be all you need to get started building your central base.

Django has the ability to do what you are looking for. A good starting point for you if you choose to pursue would be DRF. Django REST framework is a powerful and flexible toolkit for building Web APIs.
However, I think you should also weigh the cost of maintaining and developing your own IPaaS (Integration Platform as a Service) with utilizing and conforming to some self-hosted / cloud-hosted IPaaS providers.
Some providers that accomplish what you may be trying to do can be found here.

Related

How to connect a completed Vue.js app (frontend) to Django (backend)

I'm currently doing a school project that tasks us to create a functioning web application (with database) for our university. Our application is an intranet-based activities logging system.
During our first term, we finished our frontend via Vue.js / Vuetify. It has complete routers (and multiple pages), functioning buttons and data-tables (and fake authentication).
Now, we need to connect it to the backend. We chose python django REST API as our research found that it would be faster to implement (our deadline is in 2 weeks tops). My question is how to (or if it's possible) to connect our vue.js application to django so that it can fetch login authentication and database queries to our SQL (postgreSQL).
We were using the Vue CLI during the building of our frontend.
Thank you!
You don't have to worry about integration much. This is a simple REST API and a Frontend framework.
You can find many tutorials online for the same and set it up from scratch, but keeping your deadlines in mind. I think you should use this boilerplate to start with: https://github.com/gtalarico/django-vue-template

Service management using RESTful requests

I am currently working on a project where we need to establish communication like an ESB, between a REST API and the apps services on a small scale.
Scenario:
Assume a web app front end (e.g. Django/Python or Ruby/Rails) and services that are accessible via a HTTP RESTful request.
How can I:
make it configurable which web services are called on a web request depending on the request and not requiring code changes (through keys for example)
encapsulate or implement the services in a way to make it easy to manage them e.g. start/stop etc.
I have been looking at spring.io, but cant work out whether this could be used for the this??
I am open to all suggestions,
Thanks
From what I understand, you want an authorisation solution.
In Rails, Pundit and CanCanCan are very popular. You could also implement it from scratch. Here is a screencast to help you get started.

How to make a device securely communicate with a remote Database?

I created my first micro controller device and I want it to push data to a website. Basically it collects data and I want to store that in a database. But there are multiple devices and I don't want the devices to be able to read the data other devices uploaded. Now I wonder what the safest method would be?
The server runs Debian and I have full access. The device runs Debian as well and I'm coding in python.
Those are the ideas I came up with:
make the device fill out forms on a website
make the device connect to MYSQL directly
So what is the easiest way to make this right? Filling out forms seems the easiest to me, but is it really a good practice to just send POST data? How can I deal with authentication?
Conneting to the Mysql seems bad, because I don't really want to grant access to the whole table. But maybe a "add only - no read" restriction could work.
maybe you use some web framework
Use REST api to your web site. Most web framework has REST api extension.
only permit PUT, POST permission, not GET
For example, I am using django + tastypie. tastypie provide rest api for accessing django models and also provide authentication and authorization. Django REST framework is another good choice

Deciding to WSGI or Django for new web app

I'm in the process of setting up a new web app and deciding whether to just do it with WSGI or go the full framework route with Django.
The app's foremost requirements:
1) The app has no UI what so ever and all of the data is exposed to clients via a REST api with JSON.
2) It will have data to persist so MongoDB & probably Amazon's SimpleDB will be used for the database side.
Is there a reason to use Django or can I get marginal speed improvement with WSGI only?
Previous server-side apps I've built were either with Java/Struts and Groovy/Grails on the JVM. My understanding is that Django is an MVC framework similar to Rails and Grails.
I've also played around with Google App Engine which uses WSGI as thin layer above your code for managing and routing requests.
I suggest you consider something between those two extremes. Flask is lightweight, very easy to use, and connects to your web server via wsgi. You can use regular python database connectors with it, and a few databases even have Flask-specific extension modules.
I have worked with Django for a couple of projects and I like it a lot, but since you are going to use mongoDB and a lot of JSON I suggest you use NodeJS as server side, with Express as framework, you can see a brief tutorial here:
http://howtonode.org/express-mongodb
One of the advantages of this is that you will use only javascript all along your project, I began working with this technology the last month in a Hackathon, and I can tell you that I'm very impressed of how fast and simple it is.
I've worked a bit with some django "apps" ,its really easy, but setting up the "apps" can be a bit of a long process. Django has a lot of nice features that you won't be using and I agree that you might be on one "extreme" here.

Python / Django Web service Confusion

I am trying to explore more about web service in Python/Django and to be honest i am quite confused. There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live production environment
There isn't a 'standard' way, but a lot of people (including me) have used -- and like! -- Django Piston, which is actually also used to create the web service for BitBucket (where piston's source is hosted)
Also, if you're still learning about web services, I can highly recommend the O'Reilly book RESTful Web Services -- although it's a book with a focus on REST (which I agree is the best design pattern for a web service) it also explains RPC and SOAP, too.
There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
This should give you a clue - there are different services out there that use one or more of these mechanisms.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live production environment
There is no single standard way of implementing a web service. This is as true for Django/Python as for other web frameworks.
Different people have used Django in different ways to create a web service to suit their needs.

Categories