@@ -51,4 +51,96 @@ django-admin startproject nameOfProject
5151
5252This will create a "nameOfProject" directory in your current directory.
5353
54+ # Project File Structure
55+
56+ ## ` manage.py `
57+
58+ - runs commands
59+
60+ ## ` nameOfProject/__init__.py `
61+
62+ - tells ` Python ` that the folder contains ` Python ` code
63+
64+ ## ` nameOfProject/wsgi.py ` and ` nameOfProject/asgi.py `
65+
66+ - provide hooks for web servers when ` Django ` is running on a live website
67+
68+ ## ` nameOfProject/settings.py `
69+
70+ - configures the ` Django ` project
71+
72+ ## ` nameOfProject/urls.py `
73+
74+ - routes web requests based on the URL
75+
5476# Create a ` Django ` App
77+
78+ A ` Django ` app is a component in a ` Django ` project.
79+ It has a folder with a set of ` Python ` files.
80+ Each ` Django ` app has a specific purpose.
81+ Each ` Django ` project may have one or many ` Django ` apps.
82+
83+ Examples of ` Django ` apps include:
84+
85+ - blog
86+ - forum
87+ - wiki
88+
89+ To create a ` Django ` app, ** ` cd ` ** into the project folder type the following:
90+
91+ ``` {python}
92+ #| eval: false
93+
94+ python3 manage.py startapp nameOfApp
95+ ```
96+
97+ This will create the "nameOfApp" folder and files for the app.
98+
99+ Then, add app to the ` Installed_Apps ` section of ` settings.py ` :
100+
101+ ` nameOfApp `
102+
103+ # App File Structure
104+
105+ ## ` apps.py `
106+
107+ - controls settings that are specific to the app
108+
109+ ## ` models.py `
110+
111+ - provides the data layer, which is used to create the database schema and queries
112+
113+ ## ` admin.py `
114+
115+ - defines an administrative interface for the app that will allow us to see and edit the data
116+
117+ ## ` urls.py `
118+
119+ - URL routing specific to this app
120+
121+ ## ` views.py `
122+
123+ - defines the logic and control flow for handling requests
124+ - defines the ` HTTP ` requests that are returned
125+
126+ ## ` tests.py `
127+
128+ - unit tests for testing app functionality
129+
130+ ## ` migrations/ `
131+
132+ - holds files for migrating the database as we create and change the database schema over time
133+
134+ # Run ` Django ` Project
135+
136+ ``` {python}
137+ #| eval: false
138+
139+ python3 manage.py runserver
140+ ```
141+
142+ # View in Browser
143+
144+ < http://127.0.0.1:8000 >
145+
146+ ` localhost:8000 `
0 commit comments