FAQ: Creating Your First Django App - Django Apps

This community-built FAQ covers the “Django Apps” exercise from the lesson "Creating Your First Django App ".

Paths and Courses
This exercise can be found in the following Codecademy content:

Build Python Web Apps with Django

FAQs on the exercise Django Apps

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I am currently on step 15 of Introduction to Django - Fortune Teller

It states that I should be seeing fortune.html as my homepage once I save the file, but it is currently displaying the default installation success page for Django.

Here is what my views.py, urls.py, and fortune.html files look like respectively.

from django.shortcuts import render # Create your views here. def fortune(request): return render(request, 'randomfortune/fortune.html')
from django.urls import include, path from . import views urlpatterns = [ path("", views.fortune()), path("", include("randomfortune.urls")) ]
<!DOCTYPE html> <html lang="en"> <head> <title>Django Fortune Teller</title> <style> body { text-align: center; } </style> </head> <body> <h1>Here is your fortune:</h1> <p>Place holder for fortune</p> </body> </html>

Any guidance on where I’m going wrong would be much appreciated.

Hi!! Maybe you should check the project folder “fortune teller”, the file urls.py should looks like this:

"""fortuneteller URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path("", include('randomfortune.urls'))
]

For your app “randomfortune”, urls.py, should looks like this:

from django.urls import path
from . import views

urlpatterns = [
  path("", views.fortune)
]

For “randomfortune” you have to create the file urls.py, is not a default file as in the case of fortuneteller. Hope this help you. Saludos :smiley:

Hi. Driving me nuts…for days now. Got stuck on ‘point 15’ in Fortuneteller django app. I even erased whole progress to start all over, followed then every step from the tutorial video in ‘get unstuck’ section, every single step done EXACTLY like the tutor…and while his app runs in point 15, mine is giving me this ■■■■ again: 'no module named ‘‘django.contribclear’’ ’ Help please! cause I’m losing it altogether

Hi. Noone knows? That’s sad as there’ s nowhere else I can turn. Have tried to google out this exact thing but no success. So AGAIN I have reset the whole project and gone through the first 14 tasks. This time, in task 15, I am getting another error message:

can’t open. no ‘manage.py’ found

The website is robust and may hold a ton of value. But I’m getting fed up with it as it’s just not possible to be getting two different outputs for writing EXACTLY same two inputs (first 14 tasks), can it? (I have even checked the ‘hints’ and copied from those).

Time is running, and this little project for one afternoon had got me STUCK for two weeks now. and no help around whatsoever. Aah