makeBCT

#AI #OpenAI #Chatbot #Cloud #WordPress

Building a Django Web App – Django I > Django overview and debugging

Django I에서 다루게 될 내용은 다음과 같습니다.

2-1 Django installation and configuration

2-2 Django overview and debugging

2-3 Django + Bootstrap

2-4 Django functionality I

2-5 Django functionality II


이번에는 Django overview and debugging 입니다.

2-2 Django overview and debugging

main에 생성된 파일과 디렉토리에 대한 설명입니다.

디렉토리 및 파일설명
migrations/files will be automatically added to this folder as we update our project database, db.sqlite3. Each migration file added contains information on how the database will be changed/updated.
templates/folder containing HTML documents for the projects, such as home.html
admin.pyDjango comes with a pre-made admin page if you visit http://localhost/admin. This file is used to specify what should get added to the admin page since it starts off blank. We’ll eventually create a login and interact with the admin page to add products and articles to our site.
apps.pylists the name of the app we created, in this case “main”. We actually added this file to mysite > settings.py under INSTALLED_APPS.
models.pylists all the model classes we create. We will add special Django classes called model classes that store information we need for our users. Once written, we can also add these classes to the admin page in order to create and edit instances of the class. For example, we will create a Product class that will hold information for different products including a field for product names. Next, we register the Product class in admin.py so we can actually create and edit different products in the Django admin page.
urls.pywhen you click on a link in your web app, the link will connect to a specific “path” to display the correct information. The urls.py file contains the paths for our “main” app and allows us to route where a user goes when they click a link.
views.pywhen a user click a link or reloads a page, their request is handled by urls.py, which links to a function in views.py. As demonstrated with the homepage, a path in urls.py connects to a homepage function located in views.py This function is responsible for rendering the HTML template in the brower.

 

다음은 mysite에 있는 파일에 대한 설명입니다.

파일설명
settings.pycontains all basic configuration settings and used to lists all installed packages. We will continue to edit settings.py with different parameters as we install other packages.
urls.pySimilar to the urls.py file in our main folder, except this file routes urls for our entire project. You’ll notice we have a path for the admin site as well as a path to connect to the other urls.py file.
wsgi.pyspecifically used in Python web applications, this file allows your web app to connect you your development server or in future cases, production server.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

인기 글

사용자 작성 모듈 import 시 에러)(ModuleNotFoundError: No module named
파이썬 모듈을 만들고 테스트 할 때 ModuleNotFoundError: No module named 에러가 발생한 경우원인파이썬은 모듈을 불러올 때 모듈 설치 경로와 자신의...
오라클 클라우드 OCI 가입 드디어 성공 했습니다 (상세 후기)
2023년 2월 16일에 ‘오라클 클라우드 지급 검증 실패 글‘을 남긴 적이 있습니다.그 때 검색을 통해 해결 방법을 찾아 보았고, 당시 성공했던 분들의...
WSL2/Ubuntu 22.04 LTS에 Anaconda 설치 
WSL2/Ubuntu 환경에서 Python 버전별로 가상환경을 만드는 방법 중 그나마 Anaconda 방법이 좋은 것 같네요. 설치 방법은 간단합니다.1. apt update사용자...
AWS 인스턴스 유형 변경 방법
AWS 인스턴스 유형을 변경하기 위한 방법에는 다음 2가지가 있습니다.   1. 첫 번째 방법 AMI 이미지 생성 후 해당 이미지를 복원하여 신규 EC2 인스턴스를 생성하는...
[Ubuntu] ufw 방화벽 설정
ufw란?iptables 보다 쉽고 직관적으로 방화벽 설정을 할 수 있는 패키지ufw 상태 관리 명령어ufw의 상태를 관리하는 명령어# ufw 활성화 $ sudo...

BCT Ai Chatbot

답변을 준비중입니다 . . .