Blog Post Icon
Blog
08/28/2014

Brand new company site : shift8 + django

Hello!

We have recently completely re-vamped our company website : www.shift8web.ca. We have decided to move away from a conventional CMS and towards a web framework called django.

Some of the challenges encountered were from a systems administration perspective (nginx + varnish + php-fpm). Other challenges faced were migrating all our content / data into a completely different CMS than what we were used to.

Django provides many advantages, namely being a very versatile, customizable, scalable and robust web framework. We created a static html template, integrated the content models and tweaked it until we were happy.

I’ll break down the aspects from a high level to give a brief overview of whats involved in transitioning to django

models

We defined models for as much of the website as possible. Models in django are where you define your dynamically changing data (such as a page title). You can define how many characters each model will contain, what type of model it is and many more customizable options. Breaking down the site into chunks that could be defined by models was key for this project.

Here’s a sample of the front page slider model that holds the images, captions and whatnot :

class FrontSlider(models.Model):
    file = models.CharField(max_length=128)
    title = models.CharField(max_length=256)
    alt = models.CharField(max_length=256)
    caption = models.CharField(max_length=1024)

views

Views are where we interpret the data (GET or POST) and send that data to the template rendering engine to interpret and render within the HTML code. Its pretty straightforward if all you’re doing is rendering data and not manipulating it or receiving user input.

Here is a sample of the “home page” view :

def index(request):
    context = RequestContext(request)
    return render_to_response('main/index.html',
        {'portfolio': PortfolioItem.objects.all(),
        'frontdesc': FrontDescription.objects.all()[:1].get(),
        'slider': FrontSlider.objects.all()},
        context)

Now as soon as you have a contact form that accepts , processes and sanitizes user input then it gets a bit complicated. I’ll leave the examples and actual documentation / instructions for the many people who have already published guides

Essentially you need to define a view for the page that first checks if the request is a POST, then define the form and check if the input is valid. Using the django forms system is quite simple. Integrating captcha is cause for a second post, however.

    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():

Django admin backend

One of the main reasons why django is great is that you get to define and create your very own , completely customizable, admin backend! This is great for branding and customizing a CMS solution for a client with very specific needs and technical requirements.

The admin site can have its own branded custom template, and several are available commercially to purchase. The default admin template will do for now. At this point we simply define which models we want to make available in the admin site backend :

from django.contrib import admin
from main.models import *

admin.site.register(FrontSlider)

URLs

One of the last main (high level) things that we want to go over is where to define the url structure that receives browser requests and processes them to the according template view and template page respectively.

The urls.py file is what contains this “index” of directions. You define the admin site url (and how django handles a request for the admin page) here as well :

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\n", mimetype="text/plain"),

You’ll see the admin directive , as well as one for a simple robots.txt query.

We love django and want as many people to get involved in the project as possible! In the end, we love the end result of transitioning our corporate site to django.

At Shift8, we cater to all sorts of businesses in and around Toronto from small, medium, large and enterprise projects. We are comfortable adapting to your existing processes and try our best to compliment communication and collaboration to the point where every step of the way is as efficient as possible.

Our projects are typically broken into 5 or 6 key “milestones” which focus heavily on the design collaboration in the early stages. We mock-up any interactive or unique page within your new website so that you get a clear picture of exactly how your design vision will be translated into a functional website.

Using tools like Basecamp and Redpen, we try to make the process simple yet fun and effective. We will revise your vision as many times as necessary until you are 100% happy, before moving to the functional, content integration and development phases of the project.

For the projects that are more development heavy, we make sure a considerable amount of effort is spent in the preliminary stages of project planning. We strongly believe that full transparency with a project development plan ensures that expectations are met on both sides between us and the client. We want to ensure that the project is broken into intelligent phases with accurate budgetary and timeline breakdowns.

Approved design mock-ups get translated into a browse-ready project site where we revise again and again until you are satisfied. Client satisfaction is our lifeblood and main motivation. We aren’t happy until you are.

Need Web Design?

Fill out the form to get a free consultation.

shift8 web toronto – 416-479-0685
203A-116 geary ave. toronto, on M6H 4H1, Canada
© 2023. All Rights Reserved by Star Dot Hosting Inc.

contact us
phone: 416-479-0685
toll free: 1-866-932-9083 (press 1)
email: sales@shift8web.com

Shift8 Logo