Make .CSV file using MySQL and Python

In this blog, I am going to show how to develop an application by which we can make .csv files from MySQL database using Python. Now, let us start by getting data from Database. Lets say we have a DB names csv_test and it contains a table named test with fields id and name, and for testing purpose let us have some values inserted into it like this: +------+--------+ | id | name | +------+--------+ | 1 | test_1 | | 2 | test_2 | | 3 | test_3 | +------+--------+ Now, to get all…

Keep reading

Categories: CSV, Python, MySQL, technical-blogs

Django 1.7 + Scrapy

Today I am going to share how to use Scrapy and Django together to crawl to a website and store scraped data to Database using Django. First, let us build a Django application using the following commands. pip install django==1.7 startproject example_project cd example_project Inside the example_project directory, we will create a django app named app: python startapp app Then, we will update the like this: from django.db import models class ExampleDotCom(models.Model): title = models.CharField(max_…

Keep reading

Categories: Django, Scrapy, technical-blogs

Make a Blog using Django Part 2

From previous post, you have configured and ran django, also added admin site to the django. To view the working source of this tutorial, check here at: Now click on the myblog section and click add to add new blog. You can create new tags using Tags section of the admin page or clicking the (+) button right beside the Tags section on the new blog creation page, marked with blue circle in the previous image. After successfully adding a new blog, you can see it…

Keep reading

Categories: Django-View, Django, technical-blogs

Make a Blog using Django Part 1

"Making a blog using django" is probably the most made tutorial of Django. This post is no different. But I made this in my own way using some of django's built-in features so that less coding is required and making it more understandable with minimum packages to use. To view the working source of this tutorial, check here at: Before jumping to the main event, see if you have these installed in your pc: Python 3 installed in the computer. (Or python 2.…

Keep reading

Categories: Python, Django, Django-Models, technical-blogs

Change Column Header Dynamically in Django Tables2

Django Tables2 is a package which displays table directly from queryset. It shows column header based on object's attribute name. But if someone wants to override it, how can he/she do that? Here is a easy solution. Suppose we have a model class like this: class SomeModel(models.Model): somevalue = models.CharField() And we want to show table column somevalue to overridenvalue Table Class: class SomeTable(tables.Table): def __init__(self, *args, _overriden_value="",**kwargs): super().__init__(*args, **kwargs) self.base_columns['somevalue'].verbose_name = _overriden_value…

Keep reading

Categories: Django, Django-tables2, Python, technical-blogs