툴랩
close
프로필 배경
프로필 로고

툴랩

  • 분류 전체보기 (34)
    • DevLog (1)
    • Programming (18)
      • HTML (1)
      • Golang (1)
      • PHP (1)
      • Laravel (4)
      • Python (5)
      • Delphi (2)
      • Flutter (2)
      • Next.js (0)
      • Node.js (0)
      • Ruby (2)
    • Nothing (0)
    • Arduino (3)
    • Server (12)
      • RockyLinux (11)
      • CentOS (1)
  • Home
  • Tags
  • Guest
  • NaverBlog
  • YouTube

Flask, MySQL 세션를 이용한 로그인/로그아웃 예제

Flask 를 이용하여 MySQL 데이터베이스에 로그인하고 로그아웃하는 기본적인 Flask 예제입니다. 이 예제는 매우 단순한 형태이므로 실제 웹 애플리케이션에서는 보안, 에러 처리 등을 고려해야 합니다. Flask 와 MySQL 로그인/로그아웃 예제 라이브러리 설치 $ pip install flask flask-mysqldb 디렉토리 구조 /flaskapp /templates home.html login.html app.py app.py from flask import Flask, render_template, request, redirect, url_for, session from flask_mysqldb import MySQL import MySQLdb.cursors import re app = F..

  • format_list_bulleted Programming/Python
  • · 2023. 6. 28.
  • textsms
Python, Flask, ChatGPT API (OpenAI) 사용 예제

Python, Flask, ChatGPT API (OpenAI) 사용 예제

Python, Flask 를 이용해서 ChatGPT API 를 사용하는 간단한 예제입니다. 아래 OpenAI 사이트에서 API를 신청한 후 사용 가능합니다. app.py 에서 "your-openai-api-key"를 OpenAI 에서 발급받은 API 로 변경하시면 됩니다. https://platform.openai.com/overview OpenAI Platform Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform. platform.openai.com 라이브러리 설치 $ pip install flask openai 디렉토리구조 project/ ├─ app...

  • format_list_bulleted Programming/Python
  • · 2023. 6. 22.
  • textsms

CCTV 라이브 이미지 다운로드

파이썬을 이용한 CCTV 라이브 이미지 다운로드 입니다. urls 의 주소만 변경하면 가능하고 auth 정보도 CCTV 정보에 맞게 수정하시면됩니다. 예제 urls 에 있는 주소는 하이크비전 CCTV에서 이미지를 얻는 API 주소 입니다. import os import requests from requests.auth import HTTPDigestAuth import datetime urls = { 'stream2': 'http://192.168.123.2/ISAPI/Streaming/channels/101/picture', 'stream3': 'http://192.168.123.3/ISAPI/Streaming/channels/101/picture', } # 인증 정보 설정 auth = ('ID', '..

  • format_list_bulleted Programming/Python
  • · 2023. 6. 19.
  • textsms
Python, Docker, Compose, Nginx, Flask, Gunicorn 연동하기

Python, Docker, Compose, Nginx, Flask, Gunicorn 연동하기

Docker 와 Python, Flask 연동 자료가 많이 있기는 하지만 안되는 자료가 많아 최소한으로 작동이 되는 예제를 만들었습니다. 디렉토리 구조 project/ │ ├─ app/ │ ├─ __init__.py │ ├─ main.py │ ├─ Dockerfile │ └─ requirements.txt │ ├─ nginx/ │ ├─ Dockerfile │ ├─ default.conf │ └─ nginx.conf │ └─ docker-compose.yml app/main.py from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return "Hello World!" if __name__ == '__main__': app...

  • format_list_bulleted Programming/Python
  • · 2023. 6. 15.
  • textsms

이미지에서 특정 색상 범위 비율 검출

파이썬(Python)에서 이미지내 특정 색상의 비율 검출 하는 소스입니다. 이미지 처리 라이브러리인 OpenCV와 NumPy를 사용합니다. 먼저 필요한 라이브러리를 설치합니다. pip install opencv-python numpy 아래 소스는 초록색 영역의 비율을 구하는 예제입니다. import cv2 import numpy as np def calculate_wide_green_crop_percentage(image_path): # 이미지 불러오기 image = cv2.imread(image_path) # 이미지를 HSV 색 공간으로 변환 hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) # 넓은 초록색 범위 정의 lower_green = np.array([25, 20..

  • format_list_bulleted Programming/Python
  • · 2023. 6. 12.
  • textsms
  • navigate_before
  • 1
  • navigate_next
공지사항
전체 카테고리
  • 분류 전체보기 (34)
    • DevLog (1)
    • Programming (18)
      • HTML (1)
      • Golang (1)
      • PHP (1)
      • Laravel (4)
      • Python (5)
      • Delphi (2)
      • Flutter (2)
      • Next.js (0)
      • Node.js (0)
      • Ruby (2)
    • Nothing (0)
    • Arduino (3)
    • Server (12)
      • RockyLinux (11)
      • CentOS (1)
최근 글
인기 글
최근 댓글
태그
  • #Flutter
  • #flask
  • #ChatGPT
  • #PHP
  • #rockylinux
  • #Python
  • #laravel
  • #golang
  • #Laravel10
  • #라라벨
전체 방문자
오늘
어제
전체
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바