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

Unlock This Lesson

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

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Create the App

In this lesson, you’re going to create your first Django app. The command you need to use is python manage.py startapp projects. You’re going to start by creating this app and will later flesh it out, as you saw in the first section of this course.

Head over to projects and see your page running. You’ll get a message telling you that this site can’t be reached. You stopped the development server, so it’s not currently running. You can start solving this problem by opening up an extra terminal tab and starting your development server with python manage.py runserver and just keeping it running.

When you reload the page, you still get an error message. It turns out that the URL isn’t pointing to anything. The error message points you toward portfolio.urls. Take a look at urls.py in the portfolio folder.

Comments & Discussion

reblark on Oct. 17, 2019

In this presentation and in the one from Django itself, you frequently forget to mention that you turned off the server. That is a terrible mistake for the viewer because as long as the server is running, the viewer will not get the result of localhost:8000/projects and he/she will waste of lot of time trying to figure out why they still get the other error message. You need to carefully communicate everything you do. Leaving out that little bit of information is, well…I am biting my tongue.

Martin Breuss RP Team on Oct. 23, 2019

Before moving on to building your routes, make sure to register your app in the project’s settings.py file.

Check out the relevant section in the Supporting Materials. You’ll have to manually type the name of each app that you add to your Django project into the INSTALLED_APPS list in settings.py:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'your_app_name_here',  # in this case it'll be 'projects'
]

Registering the app is necessary for your Django project to know which apps are part of the project, and for everything to interact correctly.

Martin Breuss RP Team on Oct. 23, 2019

@reblark I mention in the video that the error message changes depending on whether the development server is running or not.

One of the most important things that I am trying to convey in this course is that while doing software development you’ll regularly run into error messages and unexpected situations. When something happens that is different than you expected, or different than documented, then it’s often a good idea to take a closer look.

Getting into the habit of handling these unexpected situations by looking for help in the feedback your program gives you and googling the parts that don’t make sense (yet) is an awesome way to deepen your understanding and train an approach to problem-solving that will come in handy over and over again.

reblark on Oct. 23, 2019

I appreciate this response and understand the overall suggestion. I would like to point out that many MOOCS rush to get products out, make lots of mistakes in their presentations that take hours and days to try to figure out. As I mentioned, I am running two instances of the class in order to figure things out on my own. While I buy the importance of figuring things out on your own, I believe a lot of MOOCS just avoid the responsibility of teaching. The sink or swim approach is not useful and MOOCS historically have such a high failure rate amongst their students. People simply don’t finish the course. Taking responsibility for your students is difficult and time consuming and since MOOCS are typically running on VC money, people who care about nothing but monetization, I think it is a poor business model. Your responses, and Real Python in general has been a Real Change in that and, for that, I am grateful. Thank you,

Martin Breuss RP Team on Oct. 24, 2019

Thanks! I agree with what you’re writing. “Go fast and break things” is not my favorite motto either, but it’s often applied in the tech world. ¯\_(ツ)_/¯

But our courses here are definitely not meant to be sink or swim. However, there’s always something that we might miss or not explain in the best way when creating a course. So it’s helpful when someone points out parts that ended up confusing because it makes it easier for future students and also gives us a chance to add an explanatory note.

Thanks for your work, and keep it up!

reblark on Oct. 29, 2019

Thanks for this response.

jeffwashcloth on June 4, 2020

What directory are you typing in “python manage.py startapp portfolio?”

jeffwashcloth on June 4, 2020

Sorry, above question should read: What directory are you typing in “python manage.py startapp projects?”

Martin Breuss RP Team on June 5, 2020

Hi @jeffwashcloth, you need to type this command inside of the folder where your manage.py file is located, since you are telling python to execute that file.

Become a Member to join the conversation.