본문 바로가기
Programming/Django

[Python Django - The Practical Guide] Course Setup

by Mandy's 2025. 7. 16.

https://www.udemy.com/course/python-django-the-practical-guide/?srsltid=AfmBOooIsUYcHXcq98H0RVFtBtC6ORNnGCSAvH7KEQBZfff3KPfPwNBk

본 내용은 해당 강의 내용을 참조하여 만들었음을 밝힙니다.

초기 폴더

asgi.py & wsgi.py -> related to serving our python Django Application

manage.py -> 딱히 바꿀 일 없음. 

urls.pysettings.py를 많이 바꾸게 됨.

 

❯ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
July 16, 2025 - 05:49:51
Django version 5.2.4, using settings 'mypage.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/5.2/howto/deployment/
[16/Jul/2025 05:50:39] "GET / HTTP/1.1" 200 12068
Not Found: /favicon.ico
[16/Jul/2025 05:50:39] "GET /favicon.ico HTTP/1.1" 404 2208

 

성공!
새로운 폴더가 생성됨

db.sqlite -> dummy database

아직은 신경쓸 필요 없음..

 

Django Apps

module 대신 apps라고 불린다.

기능을 가진 앱들

Mypage 안에서 또 새로운 프로젝트를 생성했다면? 'challenges'

Mypage가 project-wide configuration을 가지고 있다. 

그 안에 각각의 모듈 -> 앱이 있는 것이다. 

장고로 웹사이트를 만들면, 웹사이트는 서로 다른 웹사이트의 특징을 가질 수 있다. 

이러한 특징들은 프로젝트의 앱에 의해서 나뉜다. 

서로 다른 앱, 모듈에 의해서..

challenges말고도 새로운 앱들을 mypage안에 만들 수 있다. 

Apps are building blocks for the overall project

Apps ~= Module

구글이라는 웹 사이트 안에 구글 서치, 구글 맵 등 다양한 앱이 존재한다. 

아마존 같은 경우 아마존 샵, 아마존 비디오, 아마존 뮤직 등 다양한 앱이 존재한다 .

장고로 만든다면 큰 프로젝트를 구글이나 아마존으로 형성하고 그 안에 앱들을 여러 개 둘 수 있다. 

Your onw Online Shop이라고 하면, 큰 앱을 하나 만들고 코드를 유지하기 위해서는 또 다른 앱을 또 만들 수 있다. Products, Cart, Admin Area

작은 small module으로 만들거나 큰 모듈을 만들 수 있다. 

작은 프로젝트에선 필요 없겠지만.. 큰 프로젝트에서는 유용할 것!

자동으로 migration folder가 생성되었다!

admin.py 가 엄청 중요한 파일이 될 것이다. 

challenges 안에서 또 다른 앱을 연결할 때 이름이 중요하다. 

models.py는 데이터베이스와 디비를 연결할 때 유용하다. 

view.py 실제로 유저들에게 보여주는 모습을 담은 파일이다.