Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Build a Django Application: Overview

In this section, you’re going to build your Django application. In order to move forward, you’re going to need to have gone through all of the previous section so that your environment is fully set up.

You’re going to learn about development by error messages and develop your example app following the error messages. You’ll build your routes, create a view, create a template, and add Bootstrap to your app.

00:00 Hello, and welcome to Part 3. This is the part where we’re actually going to go ahead and build a Django application—something that we’re going to run. Remember that what do you need in order to proceed is everything that we did in the setup section, in Part 2. You need to have Python installed, you need to have a virtual environment created and activated, and inside of that virtual environment, we installed Django.

00:23 So, that needs to be set up, and you’re going to have to have some text editor or something like an IDE, like PyCharm, that you’re familiar with using. If you have all that, then you’re good to go.

00:34 What we did next was we created a Django project that we called portfolio. All that happened in the setup section. So, if you haven’t done that yet, head back to there and do that.

00:43 If you’ve done all that and you’ve got the motivation to move forward, then you’re right here in Part 3. So, let’s get going! In this Part 3, I’m going to introduce something that I call development by error messages.

00:56 So, we’re going to look at Django and develop our example app following the error messages. I’m going to talk a bit about it more in the next video, but just here to get an overview, this is the way that we’re going to approach this project. And in this part, we’re going to create a Django app and do everything that’s necessary to make it work.

01:13 So, we’re going to build out the routes, we’re going to create a view, create a template, connect these together, and we’re also going to add Bootstrap to our app so that we can have some automatic, nicer styling already included. And then finally, we’re going to do a quick recap and outlook for section 4.

01:30 So, let’s get going!

Avatar image for john09

john09 on Oct. 9, 2019

I’ve only gotten through part 1 and 2, but I will say this is an excellent tutorial so far. Very well organized, easy to understand. Looking forward to building my first Django app!

Avatar image for Martin Breuss

Martin Breuss RP Team on Oct. 10, 2019

Thank you @john09 : ) You got this!!

Avatar image for Paul

Paul on Oct. 25, 2019

Quick tip to other windows users: If get back Error: [WinError 10013] after running python manage.py runserver, trying switching up the port like this python manage.py runserver 8080

Thanks for the great tutorial!

Avatar image for gourav9042

gourav9042 on Oct. 31, 2020

How to stop the server?

Avatar image for Martin Breuss

Martin Breuss RP Team on Oct. 31, 2020

Hi @gourav9042. You can stop the development server by pressing Ctrl + c

Avatar image for Deepak Nallajerla

Deepak Nallajerla on March 9, 2021

Great job Martin. I completed 2 parts till now. Video course is very detailed very well explained each topic. Planning to complete this video course and create my own portfolio app.

Avatar image for Praveen Lodhi

Praveen Lodhi on Feb. 7, 2024

Thanks for great course!

I have one query. I have Django installed globally on my windows manchine, when trying to start the server I got the error

Traceback (most recent call last):
  File "G:\Praveen\Learning\Python\RealPythonProjects\djangoportfolio\manage.py", line 11, in main
    from django.core.management import executefromcommandline
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\Praveen\Learning\Python\RealPythonProjects\djangoportfolio\manage.py", line 22, in <module>
    main()
  File "G:\Praveen\Learning\Python\RealPythonProjects\djangoportfolio\manage.py", line 13, in main
    raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

On installing Django in the virtual env, I could start the server.

Please help me to understand how can we reuse the globally installed version of Django for a new project ?

Avatar image for Martin Breuss

Martin Breuss RP Team on Feb. 7, 2024

Hi @Praveen Lodhi, you should be able to use the globally installed version of Django. Like the ImportError mentions, it could be an issue with your PYTHONPATH environment variable. Or, otherwise, you may have installed Django not in the place that you thought you did.

Can you see Django when you list your globally installed packages?

PS:\ python -m pip list

Or, alternatively, your python command might be pointing to an unexpected version of the interpreter.

Become a Member to join the conversation.