Contact Us
24/7
Python BlogDjango BlogSearch for Kubernetes Big DataSearch for Kubernetes AWS BlogCloud Services

Blog

<< ALL BLOG POSTS

Getting Started with Django

|
March 30, 2017

Django is pretty easy to pick up. The only prerequisite for starting to learn and use Django is to have some Python experience.

And if you follow the Two Scoops of Django best practice guidelines to structure your project, getting started can be even easier. Each application you create as an add-on has the same structure, which makes it pretty straightforward to figure out where things are located.

In terms of technical requirements, you'll need Python and SQLite as the back end database to start learning. Most people switch to PostgreSQL database for production use.

How to get started

Cookiecutter can create an intitial project structure for you. Install it with pip and then run it with the url for the repository:

$ pip install "cookiecutter>=1.4.0"
$ cookiecutter https://github.com/pydanny/cookiecutter-django

Cookiecutter will ask you a series of questions about your project and then create the directory tree and boilerplate for you. This is easier than using Django's startproject command and then editing the files as needed. More information about the optons is available in the Cookiecutter documentation.

Cloning into 'cookiecutter-django'...
remote: Counting objects: 550, done.
remote: Compressing objects: 100% (310/310), done.
remote: Total 550 (delta 283), reused 479 (delta 222)
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
Resolving deltas: 100% (283/283), done.
project_name [Project Name]: Your Project
project_slug [reddit_clone]: yourproject
author_name [Your Name]: Your Name
email [you@example.com]: you@example.com
description [A short description of the project.]: A short description of the project.
domain_name [example.com]: example.com
version [0.1.0]: 0.0.1
timezone [UTC]: America/Indiana/Indianapolis
use_whitenoise [y]: n
use_celery [n]: n
use_mailhog [n]: n
use_sentry_for_error_reporting [y]: n
use_opbeat [n]: n
use_pycharm [n]: y
windows [n]: n
use_python3 [y]: y
use_docker [y]: n
use_heroku [n]: n
use_compressor [n]: y
Select postgresql_version:
1 - 9.5
2 - 9.4
3 - 9.3
4 - 9.2
Choose from 1, 2, 3, 4 [1]: 1
Select js_task_runner:
1 - Gulp
2 - Grunt
3 - None
Choose from 1, 2, 3, 4 [1]: 1
use_lets_encrypt [n]: n
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 1
use_elasticbeanstalk_experimental: n

There is also additional information provided for accommodations for local development.

From there you could do the official Django tutorial for creating an app or learn by building a custom Django app that is used in a real world project as an example to see how everything is hooked up, and follow that in the app that you are working on.

The Django Documenatation provides a lot of information, and Stack Overflow is always a big help.

And obviously, asking questions to seasoned Django developers greatly helps when you are stuck with a problem.

Django's Wins & Pitfalls

Pros:

Cons:

Tips and Advice

How can we assist you in reaching your objectives?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.