Xiaonuo Gantan's Articles
Xiaonuo loves writing Python programs to solve problems and implement systems. His research and work interests include data mining, web server architecture and relational or document-based database systems.
How to Install Django on Windows, Mac and Linux
In this article, we are going to learn how to install Django on Windows, Mac and Linux. Since Mac and Linux are both derived from the Unix platform, the instructions about installing Django on Mac and Linux are almost identical to each other and we will present them in the same section. Windows, however, is […]
Read MoreUsing Python Django’s ModelForm in Your First Django Application
Django’s ModelForm In our previous article, How to Use Python Django Forms, we learned how to create Django form objects and use them inside templates for common tasks such as data validation and HTML generation. In this article, we are going to learn how to use Django’s ModelForm to create forms directly from models. Compared […]
Read MoreHow to Use Python Django Forms
Django Form What is a HTML form? What kind of use cases does it have? A webform, web form or HTML form on a web page allows a user to enter data that is sent to a server for processing. Forms can resemble paper or database forms because web users fill out the forms using […]
Read MorePackage Your Python Django Application into a Reusable Component
Save Time by Writing and Using Reusable Python Django Apps It’s not trivial to design, develop and maintain a web application. Lots of features and aspects have to be handled properly in order for a web application to succeed. To name a few, the features that are common to almost every web application are user […]
Read MoreManaging Static Files for Your Django Application
Django’s Default Static File Manager In every web application, static files such as css, Javascript and images, give the website a unique look-and-feel and make it stand out of the crowd. For any user, a beautiful, professional looking website is way more attractive than an rough, unpolished one. In a Django application, we manage the […]
Read MoreWriting Tests for Your Django Application’s Views
Testing a Django Application’s View In our previous article, we learned how to write automated tests for our Django application, which involves writing a simple test to verify the behaviour of the model method m.Post.recent_posts() and fixing the bug where the method recent_posts() returns future posts. In this article, we are going to learn how […]
Read MoreWriting Automated Tests for Your First Django Application
Tests, Tests and More Tests As a software programmer, you often hear others talking about tests being one of the most important components of any project. A software project often succeeds when there’s proper test coverage. While it often fails when there’s little or none. You might be wondering: what are tests anyway? Why is […]
Read MoreHow to Install SQLAlchemy
In the previous article of the series Introductory Tutorial to Python’s SQLAlchemy, we learned how to write database code using SQLAlchemy’s declaratives. In this article, we are going to learn how to install SQLAlchemy on Linux, Mac OS X and Windows. Installing SQLAlchemy on Windows Before installing SQLAlchemy on Windows, you need to install Python […]
Read MoreTime a Python Function
In one of the previous articles (Measure Time in Python – time.time() vs time.clock()), we learned how to use the module timeit to benchmark a program. Since the program we timed in that article includes only raw statements instead of functions, we’re going to explore how to actually time a function in Python. Time a […]
Read MoreWriting Views to Upload Posts for Your First Python Django Application
In the previous article, we wrote an index view to show a list of posts that are created less than two days ago and a detail view to show the detailed content of a post. In this article, we’re going to write a view that allows the user to upload a post and improve our […]
Read More