이런 이런경우 메세지에 있는 포트 번호를 이용하여 사용여부를 확인
Error: listen EADDRINUSE: address already in use ::: 3000
lsof -i:3000
위 코드를 터미널에 입력하면 아래와 같은 결과를 보여준다.
여기서 PID 번호를 이용해서 사용 중인 서버 종료시키기
kill 10287
이런 이런경우 메세지에 있는 포트 번호를 이용하여 사용여부를 확인
Error: listen EADDRINUSE: address already in use ::: 3000
lsof -i:3000
위 코드를 터미널에 입력하면 아래와 같은 결과를 보여준다.
여기서 PID 번호를 이용해서 사용 중인 서버 종료시키기
kill 10287
1) 이론적인 컴퓨터의 역사
컴퓨터의 이론적 기원
사람은 다 죽는다. 소크라테스는 사람이다. 따라서 소크라테스는 죽는다. 와 같은 연역법
튜링머신(Turning Machine)
가장 단순하고 매력적인 이론적 모델. 가상적이고 논리적인 기계
튜링머시의 구성과 가정을 알게 되면 컴퓨터에 대해 전혀 알지 못하는 사람도 쉽게 그 동작 원리 및 표현 방식을 습득할 수 있다고 한다.
처치의 가정(Chuerch's thesis)
2) 기계식 컴퓨터의 역사
17세기:
19세기:
3)전자식 컴퓨터의 초기역사
20세기초
컴퓨터의 변화
1세대(1940년대 후반~)
2세대(1950년대 후반~)
3세대(1960년대 후반~)
4세대(1970년대 중반~)
프로그래밍 언어 및 기술
1956년부터 트랜지스터가 컴퓨터 개발에 사용되고 컴퓨터의 사용이 확산되면서 부터 프로그래밍의 필요성이 대두되기 시작
1950년대
1960년대
1970 년대
1980년대
1990년대
1) 슈퍼컴퓨터와 메인프레임 컴퓨터
2 ) 임베디드 컴퓨터 혹은 내장형 컴퓨터
6 장 CPU 스케줄링 (0) | 2023.12.18 |
---|---|
5 장 프로세스 관리 (0) | 2023.12.13 |
4장 프로그램의 구조와 실행 (0) | 2023.11.29 |
3 장 컴퓨터 시스템의 동작 원리 (0) | 2023.11.25 |
2장 운영체제 개요 (1) | 2023.11.25 |
2.2 앱 실행하기: Blueprint의 이용
# Blueprint 객체 생성 예
sample = Blueprint(
__name__,
"sample", # Blueprint 앱 이름
static_folder="static", # Blueprint 앱의 static 파일용 폴더 디렉터리(폴더 위치) ex styl.css
template_folder="templates", # Blueprint 앱의 템플릿 파일 폴더 디렉터리, xx.html 과 연결하기 위함
url_prefix="/sample", # Blueprint앱의 모든 URL의 맨앞에 추가하여 다른 앱의 경로와 구별 하기 위한 경로
subdomain="example", # Blueprint를 서브 도매인으로 하는 경우에 지정
)
# Blueprint 객체 등록
app.register_blueprint(sample, url_prefix="/sample", subdomain="example")
from flask import Blueprint, render_template ------------------------------------- Q
# Blueprint로 crud 앱을 생성한다
crud = Blueprint(
"crud",
template_folder="templates",
static_folder="static".
)
# index 엔드포인트를 작성하고 index.html을 반환한다
@crud.route("/")
def index():
return render_template("crud/index.html")
2.3 SQLAlchemy 설정하기
2.4 데이터 베이스 조작
File "E:\_CosmosMedic\스터디\Flask\venv\lib\site-packages\sqlalchemy\engine\url.py", line 893, in _parse_url
components["port"] = int(components["port"])
ValueError: invalid literal for int() with base 10: '\\_CosmosMedic\\스터디\\Flask\\local.sqlite'
# 앱의 config 설정
# app.config.from_mapping(
# SECRET_KEY="2AZSMss3p5QPbcY2hBsJ",
# SQLALCHEMY_DATABASE_URI=f"sqlite://{Path(__file__).parent.parent / 'local.sqlite'}",
# SQLALCHEMY_TRACK_MODIFICATIONS=False,
# )
import os
basedir = os.path.abspath(os.path.dirname(__file__))
app.config["SECRET_KEY"] = "2AZSMss3p5QPbcY2hBsJ"
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(
basedir, "database.sqlite "
)
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
2.5 데이터베이스 이용한 crud 앱 만들기
2.6 템플릿의 공통화 상속
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<!-- title을 상속처에서 구현한다 -->
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('crud.static', filename='style.css') }}" />
</head>
<body>
<!-- content를 상속처에서 구현한다 -->
{% block content %}{% endblock %}
<!-- 상속처에 개별의 구현이 필요하면 여러 개를 사용 -->
<!-- 예시 -->
<table> {% block table%} {% endblock %} </table>
</body>
</html>
<!-- base.html 상속 해서 -->
{% extends "crud/base.html" %}
{% block title %}사용자의 일람{% endblock %}
<!-- body -->
{% block content %}
<h2> base.html 사용법</h2>
.....
{%block table}
<tr>
<th> ID </th>
<th>사용자 명 </th>
<th>메일주소</th>
</tr>
{% endblock %}
2.7 config 설정하기
Part 0 파이썬 플라스크 소개 (3) | 2023.11.21 |
---|---|
책관련 자료 (1) | 2023.11.21 |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
설치가 완료되면 마직막 안내 메세지 꼭! 확인해서 따라하기.brew install --cask anaconda
export PATH="/opt/homebrew/anaconda3/bin:$PATH"
conda init zsh
터미널을 다시 시작하면 앞에 (base) 가 뜨는 것을 확인 가능conda create --name 가상환경명 python=파이썬버전
# 가상환경 실행
conda activate 가상환경명
pip install flake8 black isort mypy
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
{
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--max-line-length=88" ],
"python.formatting.provider": "black",
"editor.formatOnSave": true, "editor.codeActionsOnSave": {
"source.organizelmports": true },
"python.linting.mypyEnabled": true
}
curl -L http://www.gitignore.io/api/python,flask,visualstudiocode > .gitignore
Part 1 플라스크 첫걸음 : Ch 01 최소한의 기능 앱 만들기 (0) | 2023.11.23 |
---|---|
책관련 자료 (1) | 2023.11.21 |
<2023.04 월에 노션에 정리해둔 자료를 티스토리로 옮김 >
예제 코드및 다운로드 링크
참고할 만한 사이트
https://flask.palletsprojects.com/en/2.2.x/quickstart/#
Quickstart — Flask Documentation (2.2.x)
Quickstart Eager to get started? This page gives a good introduction to Flask. Follow Installation to set up a project and install Flask first. A Minimal Application A minimal Flask application looks something like this: from flask import Flask app = Flask
flask.palletsprojects.com
https://flask-docs-kr.readthedocs.io/ko/latest/testing.html
Flask 어플리케이션 테스트하기 — Flask 0.11-dev documentation
이 문구의 기원을 정확하게 알수는 없지만, 이것은 진실에 가깝다. 테스트되지 않은 어플리케이션은들은 기존 코드의 개선을 어렵게 하며 프로그램 개발자들을 심한 편집증환자로 만들어 버린
flask-docs-kr.readthedocs.io
Part 1 플라스크 첫걸음 : Ch 01 최소한의 기능 앱 만들기 (0) | 2023.11.23 |
---|---|
Part 0 파이썬 플라스크 소개 (3) | 2023.11.21 |