Talk about technologies

Multi Tenant Application using Django – Connect and manage multiple databases to the single application

     Today I am going to talk about multi-tenancy. What is multi-tenancy and how to make a multi-tenant architecture based application. Multi-tenancy refers to single instance of the application which server multiple tenants. Tenants refer to the group of users who have common access with specific privileges to the software resource. Suppose that there is a simple application connected to the multiple databases, and each database belongs to the specific users or tenant. Today, I am going to show you how to make a Django Applicaion connect to the multiple database, switching the databases at run time, get data from the multiple databases and also managing the django admin of the each database site. By the database site we refer to the URL where particular database can be managed. Each database has its own corresponding URL or site, eg: testdb1 has admin uri say – http://localhost:8000/testdb1_admin/ or testdb2 has admin uri say – http://localhost:8000/testdb2_admin/. If you are only interested in the source code, it is hosted in my github account here – To set up the project:-

     In the […]

Integration of Elastic Search and Django(A Python Framework) – Part three

In the previous tutorials I made a simple django application, and made a custom command(seed_db) that populate the database with the dummy data, also take count as argument of how many products will be created. Now In this tutorial we will learn, how to index our database with the elastic search. Elasticsearch, in simple words it is like a search engine provide capabilities like full text searching, filtering, faceting and many more with fast speed on non relational JSON like documents. So its like a private search for your web application. Upto this level we had a simple django based application consist of the five models, one is built in model, i.e. User model from django.contrib.auth.models, others are Product, Category, Subcategory and the UserProfile model. We also implemented a custom command to populate database with the dummy data. So we can have any number of dummy records in our db, to make it indexed in elasticsearch. So thats the reason to make seed_db command. Now I am going to make one more custom command i.e. index_db, to index the database […]

Integration of Elastic Search and Django(A Python Framework) – Part One

In this tutorial I am going to show you the Integration of Elastic Search and Django. I am using Django 1.10, ElasticSearch 5.2.0, and Ubuntu 16.04 OS for the application. Lets Have a look on the model we are going to build.      A simple application that have five simple models : – Product Model, Category Model, SubCategory Model, UserProfile, and the User Model. This is the part One of the tutorial, in this part I am going to build an application at Django Part. To install Django on your system refer here. Open terminal and type command

make virtual environment

activate the virtual environment

install django 1.10 in the virtual environment using pip

make a app named core that will contain our models

Here is the directory structure for our application go to the elasticdjango/ file and add the core application to the Installed apps:- add following code to the core/ file

Don’t worry if you are not able to understand this time the whole code. This in simple words contain the models definitions […]

Show Buttons
Hide Buttons