Skip to content

Commit

Permalink
Add pennapps config to settings to begin with
Browse files Browse the repository at this point in the history
  • Loading branch information
vcai122 authored Jan 25, 2023
1 parent 0c7b040 commit 17d204e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions PennAppsChallenge/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# Application definition

INSTALLED_APPS = [
'pennapps.apps.PennappsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To start, make sure you are in the directory that contains `manage.py`. This is
- PennAppsChallenge - you can think of this as the entry point to our Django application. Two important files it contains is `settings.py` which contains our project settings and `urls.py` which tells our app which urls to keep an eye out for (more on this later).
- pennapps - this is an "app" that we created beforehand which contains some starter code for you. Django projects can consist of many "apps" that are usually created with `python manage.py startapp app_name` (think an app as an isolated piece of "business logic" that work together in the overall app) but ours will only use one since our project is quite basic. You will mainly be working in this directory.

*Now, in order to tell Django that pennapps is an "app" in our project, ***make sure to add*** `'pennapps.apps.PennappsConfig'` to the list of installed apps in our `settings.py`.*
*Now, in order to tell Django that pennapps is an "app" in our project, make sure `'pennapps.apps.PennappsConfig'` is in the list of installed apps in our `settings.py`.*

#### URLs and Views
Next, let's understand how the url flow works. Visit`PennAppsChallenge/urls.py`. Recall that this contains all the relevant urls to our project which is listed in `urlpatterns`. The first entry here,`path('admin/', admin.site.urls)`, tells Django to put the admin site on `/admin/` and the second entry, `path('', include('pennapps.urls'))` tells Django to include all the urls found in `pennapps.url` (`urls.py` in the pennapps subdirectory). Visiting `pennapps/urls.py` we see a similar `urlpatterns` list. Note however that these urls would not have been added to our Django application by default if we hadn't specified to include these urls in `PennAppsChallenge/urls.py`.
Expand Down

0 comments on commit 17d204e

Please sign in to comment.