DEV Community

SparkedScience
SparkedScience

Posted on

Django and SQL; What is Django?

Background

I have a fair amount of experience with Django, which is a Python based web development framework. The beauty of Django is the abstraction within creating fully functional websites. Developers have access to Python libraries as normal, but Django also makes working with databases easy. Models are database tables, and those are easy to create. Adding data is three lines of code. In total, developers only need to edit four files to send data to a database. Django also comes with a built in admin page to view data graphically.

Experience

I will go talk about the technical aspect of this project in the video later on. For now, I am here to tell you about my experience working with Django. I created a simple form that sends data to a model, then the data is viewed in the admin page. This is my third site built with Django, so I have a fair bit of experience with the framework. It isn't much, but it is live at sparkedscience.com. Django is easy to learn with the tutorial on their website, so creating the site was not an issue. To be honest, most of the code needed to work with databases needs to be referenced. I found myself constantly using the tutorial and documentation to get the right fields for my model to create database tables. To send data to the database, you have to have a form. Django requires some added lines of code for security reasons. There is a line to make sure the form is valid and completely filled out. Another line in the HTML file prevents cross site attacks with a csrf token. There is yet another part in the code to ensure the user is POSTing data, instead of GETting data. This extrapolation of not having to custom build these security features is an amazing bonus to using Django. One downside is that it is difficult to use in production. Many developers do not use Django as a development framework as it is newer. I have been trying to get a website into production with Django for months on Raspberry Pis with no luck. Reclaim Hosting does support Django with an easy five minute tutorial that I found from their forums. Django comes with an admin page already created so developers can manage their databases while the site is up. Overall, I enjoy working with Django as it extrapolates many painful aspects of web development and comes with a graphical admin page.

Technical Database Video

Youtube Video

Top comments (0)