Posts Tagged ‘website’

Run cron jobs within Django using django-cron

Quite often web applications require cron-like behavior which more or less contradicts with the request-response model.

Not many host providers allow users to create a cron jobs, and even if it is possible, if your site relies on an external script it loses its integrity. It no longer is a website, it is a website relying on cron jobs.

Now at first glance, there is not much difference, but such things make migrating harder and/or may cause a lot of problems in the long run.

As we all know Django is an open source web application framework, designed for rapid development. It follows the so called DRY principle and therefore greatly emphasizes on “pluggability”. In this short tutorial we will show you how to “plug-in” a little but very useful Django application called django-cron, which allows you to easily get cron line behavior.

You can visit the project’s site in at http://code.google.com/p/django-cron

Installation is fairly easy:

  • Download the source
  • Place django_cron on your python path
  • Add “django_cron” in the list of installed apps in your settings.py:
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',
    'django_cron',
)
  • In the beginning of your global urls.py file add:
import django_cron
django_cron.autodiscover()
  • Write your crons in a file named cron.py inside the application you want write crons to. Note: The application must be installed in your settings.py

A cron job is fairly easy to write.

Here is an example cron.py file which deletes old files from a fixed directory:

import os
import time
from django_cron import cronScheduler, Job

class DeleteOldFilesCron(Job):
“””A cron which deletes files older than a minute from a fixed directory”””

    run_every = 60*60*24 # run every day

    def job(self):
        path = ‘/var/www/html/media/tmp/’
        files = os.listdir(path)
        for file in files:
            if(time.time() – os.path.getmtime(path + file) > 60):
                os.remove(path + file)

cronScheduler.register(DeleteOldFilesCron)

Naturally you can have several crons in your cron.py

Note: There are some Apache specific configurations which must be taken into account. For more information visit http://code.google.com/p/django-cron/wiki/Install

VN:F [1.9.18_1163]
Rating: 3.0/10 (2 votes cast)

Japanese city migrates its entire website to Facebook

The first city to replace all of its public websites with Facebook pages is the Japanese city Takeo. Officials pointed the “open nature” of the social network as their main reason.

The social network was pretty slow to establish itself in Japan. The main reason for that is that users prefer anonymous services and hangouts.

City officials in Takeo, stated that when they used anonymous services, users posted rude (often mixed with a lot of profanity) commentaries which were not actually helpful.

“When people give their opinions or ask questions, they should take responsibility for this as adults, and this should be done using their real names” stated the mayor of Takeo Keisuke Hiwatashi. The page  http://www.facebook.com/takeocity is setup so that anyone can see its content, but you must be registered to leave comments. Most of the materials are actually hosted on government servers, but are accessible only through Facebook.

According to city officials the whole migration cost 630 000 yen (around $8200). The transition was resisted by many people because they were not familiar with Facebook.

Takeo officials have already expressed their satisfaction, as pretty much all of the comments and complaints they have received are no longer meaningless aggressive criticism – exactly the opposite, they are actually quite reasonable.

However, in an online debate, many people have expressed their reservation and have criticized the choice of Takeo’s officials as it interferes with their right to state their problems and complaints anonymously.

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

14 advises for how to design your website’s navigation

One of the most important things to keep in mind when designing a website is navigation. You don’t like getting lost in a city you don’t know, do you? Well, neither do your users. You won’t tolerate travelling for two hours just to buy a cup of coffee, will you? Well, neither will your users. In this short article we will provide you with a few guidelines to follow when designing your site.

1. Each page should show the basic structure of your site.

2. Make each action sequence clear and structured. Remember, users don’t know what your website’s back-end is. What you may find to be logical on a technical level may be irrational on a logical level.

3. Keep each screen as clean as possible. Align page elements horizontally or vertically.

4. Be consistent with the placing of important items. Highlighting critical information is a must.

5. Keep your site’s structure as broad and as shallow as possible.

6. Carefully choose your header and bottom of the page. Make sure the user doesn’t get confused that he has reached the top/bottom of the page when he hasn’t.

7. No horizontal scrolling.

8. Links should be self-explanatory.

9. Avoid elements that look clickable, but are not.

10. Make sure that category labels are distinguished from ordinary ones. They should be self-explanatory. Never forget that page titles should be descriptive.

11. Navigation labels should be consistent with page titles/headings. Tooltips are your friends.

12. Heading should be descriptive and consistent throughout the site. This helps users familiarize the site structure.

13. Order items in the lists by importance. Users scan content top-bottom.

14. List ordering should be consistent between pages.

Follow these guidelines and your website’s navigation will be user friendly and intuitive.

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

Why do not the website visitors convert into customers?

Only a few visitors become clients and you\”re wondering why is that. First, let\”s define \"a few\": depending on what the website is about, or the type of services or products it\”s selling, a typical website has a conversion rate between 0.5% and 8%, where 2% is the average. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

Why is not a website on the first page of Google and should a Web designer care?

Let\”s start by assuming you\”re doing a damn good job at designing and implementing websites for your customers. And not only that you\”re quick and you use table-less code, but the layouts look awesome and work the same in all browsers.

I’ll answer that by telling you what the customer will ask as soon as the site is online and past the honeymoon period: “why isn’t my site appearing on the first page of Google where all the competition is?” Well, it needs some SEO, and for that there are companies that provide consultancy and services. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

How to Embed Flickr Slideshow on Website

There are a lot of fancy slideshows in your flickr account, but how to embed them into your blog or website? This tutorial shows simple steps for embed flickr slideshow on website without any flash or xml skills.
Here I introduce a web flash slideshow maker to you, which combines your digital photos into web flash slideshow and 3D gallery in minutes. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Creating A CSS Layout In Dreamweaver from PSD

In this tutorial we will go through the steps of creating a CSS website starting from a layout received from the designer. We will explain how to understand the page structure and how to use the Flexi CSS Layouts to create the CSS layout without coding. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Creating A 3 Columns Fixed CSS Layout

In this tutorial we will use the Flexi CSS Layouts Dreamweaver extension to create a simple 3 columns CSS layout with a fixed width. Not only that you can create fixed, liquid or elastic layouts in seconds, but you can generate custom website sections with unlimited DIV levels, following even the most detailed mock-ups from your designer. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Creating a round corner css website layout

We all want to build clean CSS web pages, right? But what we could do more than just that and make it have rounded corners, flashy unlimited levels menu and a flash dynamic news feed on the right panel? Something like this web 2.0 template with nice round CSS corners and a right panel with a flash dynamic news feed. Here is my layout: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.9/10 (11 votes cast)

How to use Higosoft Web Player

Higosoft Web Player is a easy-to-use and intuitive web video authoring tool and flash video player, which could help you embed and publish amazing video online, so that you could stream and play various on your website.

It provides you a great to publish video tutorial, video presentation, video clip online, such as share favorite video, publish online video tutorial and guides, publish movie trailer. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)