Skip to main content


Send POST file using Curl in PHP

Recent posts

ManyToMany relationship in django models

I'm trying to add relation between three table with manyToMany relationship. I'm learning python and new for Django framework. For requirement, An user can add a project and he also can add permission for view for another user. It means an user can have multiple projects and a project also have multiple user. User model is default user model of django.
and the project model is:
from django.db import models from django.contrib.auth.models import User # Create your models here. class Projects(models.Model): project_title = models.CharField(max_length=255) description = models.TextField(blank=True) privacy = models.SmallIntegerField(default=1) # 1 for public, 2 for private status = models.SmallIntegerField(default=1) #1 for active, 2 for deactive, 3 for delete, 4 for depricated created_at = models.DateTimeField('date published', blank=True, default=False) users = models.ManyToManyField(User, through="UserP…

Run Django server for permanent on Centos and Ubuntu

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

 This article assumes that you have already Django installed alreay. If you don't, you can install Django from here. 

To start Django project, Django have a command for run development server.

python runserver
Now problem is that, after close the terminal server has also stopped. And you can't access your project anymore.

Now what we have to do to run Django server for permanent? 

There are so many methods to run any server for permanent but we will discuss the easiest method to run server.

We are talking about Screen. 
This is  the simple method to run server forever.

First install screen on your system.
Here the guidelines to install screen on linux …

How to install and use "Screen" on Centos and Ubuntu

This article will introduce you to a handy application called "Screen"

We all are familiar with Terminal OR SSH OR Putty. 
We all knows the limit of these tools if we close terminal, we lost our progress. So to handle this problem, There comes Screen to manage all connections.

Installation of screen on Centos6, Cents7
$ sudo yum install screen
Installation of screen on Linux, Ubuntu
$ sudo apt-get install screen

Install a MySQL server on Centos7 using CMD

MySQL is an open-source relational database that is free and widely used. It is a good choice if you know that you need a database but don’t know much about all of the available options.

This article describes a basic installation of a MySQL database server on CentOS Linux. You might need to install other packages to let applications use MySQL, like extensions for PHP. Check your application documentation for details.

Install MariaDB Install the MariaDB server through the CentOS package manager (yum) by running the following command at a command prompt:

sudo yum install mariadb-server mariadb

Start and stop the database service Use the following command to start MariaDB:
sudo systemctl start mariadb.service
Use the following command to stop MariaDB:

sudo systemctl stop mariadb.service
Launch at reboot To ensure that the database server launches after a reboot, you must enable the chkconfig utility. Use the following commands to do this.
Enable chkconfig on MariaDB
sudo syste…

Google material tabs for website

The MDC Tabs component contains components which are used to create spec-aligned tabbed navigation components adhering to the Material Design tabs guidelines. These components are:
mdc-tab: The individual tab elementsmdc-tab-bar: The main component which is composed of mdc-tab elementsmdc-tab-bar-scroller: The component which controls the horizontal scrolling behavior of an mdc-tab-bar that overflows its container
Example: Tabs  <section id="dynamic-demo-toolbar"> <nav id="dynamic-tab-bar" class="mdc-tab-bar mdc-tab-bar--indicator-accent" role="tablist"> <a role="tab" aria-controls="panel-1" class="mdc-tab mdc-tab--active" href="javascript:void(0)">Item One</a> <a role="tab" aria-controls="panel-2" class="mdc-tab" href="javascript:void(0)">Item Two</a> <a role="tab" aria-cont…

How to save a Form into database in Django

Django is the most popular framework for python.

Here we'll discuss about save a form into database in Django.

Step 1:  First create a model '' for DB table. we are creating a model named 'Request'.

from django.db import models # Create your models here. class Request(models.Model): request_url = models.CharField(max_length=255) created_at = models.DateTimeField('date published')
run command
python migrate . This will create a table into your DB, with two columns.`request_url` and `created_at`.
Step 2:  Now create a '' to define your form. This will render a form in template with HTML code.  Here creating a form 'RequestForm'.

from django import forms class RequestForm(forms.Form): request_url = forms.CharField(label="Enter your URL", max_length=500)
we have a single field form 'request_url'
Now import your model and form into your views. Discuss in next step.

Step 3:…