Posts

Showing posts with the label web development

Using a slug in Django

Image
  Generating slugs automatically in Django without packages - Two easy and solid approaches Image: Slugs in Django (License: CC-BY-SA Marcelo Canina) Slug generation management Overview One important task when developing a Django website is to have pretty URL s , i.e.: human readable and SEO friendly URLs . A site's URL structure should be as simple as possible. Consider organizing your content so that URLs are constructed logically and in a manner that is most intelligible to humans (when possible, readable words rather than long ID numbers) Keep a simple URL structure Google Webmasters Options We will explore two approaches to have clean URLs , from having the typical Django’s URLs with the object/pk scheme, like /article/12345 to have one of these: pk and slugs : object/pk-slug like /article/12345-my-example-title where we add the object’s slug after the primary key. unique slug : generate a unique slugs with...

What is the cause of slow website loading and the solutions for it

Image
Top 10 Reasons Your Site is Loading Slow (And steps you can take to fix it!) Ever wonder why your website is slow to load? Here are 10 of the most common reasons for slow website loading times, and also tips on how to fix it. Don’t be slow! You might have heard that age-old adage which says “slow and steady wins the race”, but when it comes to the performance of your website, that certainly is a recipe for failure. Here are our Top 10 Reasons for Slow Loading Websites. 1. Unoptimized Images A large volume of unoptimized images is usually the most common reason behind website slowness. High-resolution images can consume lots of bandwidth while loading. Uploading larger sized images and then scaling them down can unnecessarily increase the size of your web page – causing your website to load slowly. The image format is another important factor to consider. For example, JPEG images are much smaller in size compared to other image formats like PNG or GIF. Quite naturally, your web page...

Learn Django for web development

Image
A fundamental trade-off in dynamic websites is, well, they’re dynamic. Each time a user requests a page, the Web server makes all sorts of calculations – from database queries to template rendering to business logic – to create the page that your site’s visitor sees. This is a lot more expensive, from a processing-overhead perspective, than your standard read-a-file-off-the-filesystem server arrangement. For most Web applications, this overhead isn’t a big deal. Most Web applications aren’t  washingtonpost.com  or  slashdot.org ; they’re small- to medium-sized sites with so-so traffic. But for medium- to high-traffic sites, it’s essential to cut as much overhead as possible. That’s where caching comes in. To cache something is to save the result of an expensive calculation so that you don’t have to perform the calculation next time. Here’s some pseudocode explaining how this would work for a dynamically generated Web page: given a URL , try finding that page in th...