Django

“Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.” -Django

Django is aimed towards larger applications and has an “out of the box” feel – where things happen with minimal effort/connecting. It has tons of infrastructure and built ins – lots of magic.

When you start a Django project, it comes with everything you need to run a web app locally. Thats the magic – things are already connected and working. Since Django has been supported for over 10 years and has a large community, there is a lot of support and code that makes this happen.

One of the great built in parts is that Django has an admin system. You are able, out of the gate, to add users, manage roles and permissions. Its not 100% secure, but you’ll have the foundation already set up – plus its more secured than anything I can make at the moment 😉 If your planning on deploying, remember to source your keys before you commit!

What is nice is that all your urls are managed in one spot (url.py). The one things that may look like crazy talk is the url patterns because its done in regular expression. You can have functional views, class-based views and import from other url-pattern files from other parts of you directory (as you build out your project). If this is sounding a little confusion, don’t worry. There is so much support out on the interwebs that you can easily look up. The nice thing about being able to import url-patterns is that you have each “part” or “feature” of you app be self-contained (i.e. all your blog posting urls are together and you import them, so if you are working on another project, you can easily grab that feature and add it to the new project).

Because Django has so much built out, it can be a little disorienting at first with what is happening and how. Especially because it creates tons of directories, files and connects you with a sql db. It takes a little time to figure out what parts are playing with other parts, but once you get that down, its a lot of pattern matching to solve other issues. I recommend doing a tutorial to have some guidance and you’ll start seeing the pattern. Once you sort of see the pattern, I recommend trying to break it to get a better sense of what is going on.

I can’t stress it enough, Django’s set up is super easy and its intended be used straight out of the box. Below is an example of the code you need to type to get a super basic Django web app up:

django

>>> pip install Django
>>> django-admin startproject demo
>>> cd demo
>>> python manage.py runserver

 

Go to: 127.0.0.1.8000

django

Here are some great tutorials for you to start with :

  • DjangoGirl Tutorial: This gives you a lot of background information about how the web works, how to install python and code editor, as well as creating a blog app in django. Great for newbies!
  • Django Web Development Video Series: Harrison Kinsley takes you through a demonstration of setting up a Django app with fantastic explanation.

Not sure if you should use Flask or Django frame work? Hate having to do research? Hate making a decision? Don’t worry, there is a questionnaire you can do to help you decide: Django vs Flask Questionnaire  

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s