• Complain

Samuli Natri - Django - The Easy Way (3rd Edition)

Here you can read online Samuli Natri - Django - The Easy Way (3rd Edition) full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: leanpub.com, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Django - The Easy Way (3rd Edition)
  • Author:
  • Publisher:
    leanpub.com
  • Genre:
  • Year:
    2017
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Django - The Easy Way (3rd Edition): summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Django - The Easy Way (3rd Edition)" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Samuli Natri: author's other books


Who wrote Django - The Easy Way (3rd Edition)? Find out the surname, the name of the author of the book and a list of all author's works by series.

Django - The Easy Way (3rd Edition) — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Django - The Easy Way (3rd Edition)" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Django - The Easy Way 3rd Edition How to build and deploy web applications - photo 1
Django - The Easy Way (3rd Edition)
How to build and deploy web applications with Python and Django
Samuli Natri

This book is for sale at http://leanpub.com/django-the-easy-way

This version was published on 2020-03-14

This is a Leanpub book Leanpub empowers authors and publishers with - photo 2

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.

* * * * *

2017 - 2020 Samuli Natri
Introduction
About the author

Samuli Natri is a software developer. He studied computer science at Helsinki University of Technology.

About Python

Python is a general-purpose programming language that is used in wide range of domains, including scientific computing, artificial intelligence and web development.

About Django

Django is a Python-based web framework that allows you to build dynamic, database-driven applications without having to re-invent the wheel. It provides a lot of features out-of-the-box like database abstraction layer and templating engine. Instagram, Bitbucket and Disqus uses Django.

Who is this book for

This book is intended for anyone who is interested in learning the Django web framework key features in a practical, step-by-step manner. You are not required to have any previous experience with web development or programming languages to be able to follow along.

What this book covers

This book introduces the reader to all essential Django web development concepts, such as views, models, databases, templates, forms, authentication, deployment, APIs and testing.

GitHub repository and feedback

The complete source code can be found in GitHub: http://bit.ly/38A12sff. Feel free to send feedback at contact@samulinatri.com.

Installing Python

Visit http://www.python.org and install Python. Check Add Python x to PATH if you are using the Windows installer.

Search for Terminal or Command Prompt to find a terminal program and open it up.

Run the following command:

Command Prompt
~ python3

You might need to use py or python on your system. This puts the Python interpreter in interactive mode:

Command Prompt
Python 3.x.x ...Type "help" ...>>>

Make sure you are running Python version 3.

Python interpreter is a program that translates source code into intermediate representation and immediately executes it.

In the interactive prompt we can type and run Python code directly without creating a .py file:

Interactive Prompt
>>> a = 1>>> b = 1>>> print(a+b)2>>> exit()
I Blogging Platform
Creating A Django Project

This chapter covers

  • Creating virtual environments
  • Installing Django
  • Creating a new Django project
1.1 Creating virtual environments

With virtual environments each project can have its own unique set of dependencies. You can work on multiple projects simultaneously without them interfering with each other.

Use these commands to create and activate a virtual environment in Unix-like systems:

Command Prompt
python3 -m venv ~/.virtualenvs/mysitesource ~/.virtualenvs/mysite/bin/activate

Use these commands in Windows:

Command Prompt
py -m venv %HOMEPATH%\.virtualenvs\mysite%HOMEPATH%\.virtualenvs\mysite\Scripts\activate.bat

You can create the virtual environment directory anywhere in your system. In this case we use the .virtualenvs directory inside the users home directory.

The (mysite) prefix indicates that the environment is active:

Command Prompt
(mysite) ~

deactivate command deactivates the environment.

Check out virtualenvwrapper and pyenv if you are looking for more comprehensive tools for virtual environment and Python version management.

1.2 Installing Django

Django is installed like any other Python package:

Command Prompt
pip install django

This will install Django inside the virtual environment directory we just created (~/.virtualenvs/mysite). Pip is a Python package manager.

1.3 Creating a new Django project

Create a new Django project:

Command Prompt
mkdir mysitecd mysitedjango-admin startproject mysite .
  • django-admin is a command line tool for administrative tasks.
  • The startproject command creates the Django project directory structure. mysite is the name of the project. Use . (dot) to create the project in the current directory.

You should now have this kind of directory structure:

Command Prompt
mysite manage.py mysite __init__.py settings.py urls.py wsgi.py

You have to tell Django which settings youre using by defining an environment variable named DJANGO_SETTINGS_MODULE. manage.py works like the django-admin utility but it also conveniently points the DJANGO_SETTINGS_MODULE system variable to the project settings.py file.

We use the term project to describe a Django web application. The mysite subdirectory inside the main mysite directory is the project Python package. Inside it we have the project settings, URL declarations and WSGI configuration. The __init__.py file makes this directory a Python package.

WSGI is a standard that defines how applications and servers communicate with each other.

Django provides a built-in development server. Run the following command to start it:

Command Prompt
python manage.py runserver

The You have x unapplied migration(s) warning is related to database migrations. You can ignore it for now.

Visit http://127.0.0.1:8000 with a browser and you should see the welcome screen:

Use the built-in server only for development purposes There are better options - photo 3

Use the built-in server only for development purposes. There are better options for production environments (like Nginx and Gunicorn).

1.4 Summary

We use virtual environments to manage project dependencies. Pip package manager makes it easy to install Python packages (like Django). The django-admin startproject mysite . command creates a Django directory structure. Django comes with a lightweight web server that you can use when building the website.

Creating Apps

This chapter covers

  • Adding features with apps
  • Configuring URLs
  • Creating views
  • Creating templates
2.1 Adding features with apps

App is a Python package that usually contains models, views, URLs, templates and other files needed to implement some set of features. Lets start by adding a blogging app that allows us to write and publish blog posts.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Django - The Easy Way (3rd Edition)»

Look at similar books to Django - The Easy Way (3rd Edition). We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Django - The Easy Way (3rd Edition)»

Discussion, reviews of the book Django - The Easy Way (3rd Edition) and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.