python9 gunicorn 구니콘 유니콘 관련 systemctl: /etc/systemd/system/gunicorn.service[Unit]Description=Gunicorn + Uvicorn Worker ServiceAfter=network.target[Service]User=ubuntuGroup=ubuntuWorkingDirectory=/home/ubuntuExecStart=/home/ubuntu/venv/bin/gunicorn 프로젝트명.asgi:application \ -k uvicorn.workers.UvicornWorker \ -w 4 \ -b unix:/tmp/gunicorn.sockRestart=alwaysKillSignal=SIGTERMType=simple[Install]WantedBy=multi-user.target 시작:.. 2025. 6. 19. django - settings.py 기본 보안 설정 import socketimport os# 현재 호스트네임 가져오기hostname = socket.gethostname()if hostname.startswith("ip-"): # AWS EC2 서버일 경우 DEBUG = False ALLOWED_HOSTS = ["your-domain.com"] # 실제 도메인으로 변경하세요. # HTTPS 강제 설정 SECURE_SSL_REDIRECT = True # HTTP -> HTTPS 자동 리디렉션 # 쿠키 보안 강화 (HTTPS에서만 동작) SESSION_COOKIE_SECURE = True # HTTPS 환경에서만 세션 쿠키 허용 SESSION_COOKIE_HTTPONLY = True # JavaScript에서 .. 2025. 2. 25. uwsgi 자동 시작 설정 [우분투] 서버 리부팅 시의 자동 시작 설정 방법입니다. sudo vim /etc/systemd/system/uwsgi.service[Unit]Description=uWSGI Emperor ServiceAfter=network.target[Service]ExecStart=/home/ubuntu/venv/bin/uwsgi --ini /etc/uwsgi/sites/djangoProject.ini [여기만 바꿔주세요]RuntimeDirectory=uwsgiRestart=alwaysKillSignal=SIGQUITType=notifyNotifyAccess=all[Install]WantedBy=multi-user.targetsudo systemctl daemon-reloadsudo systemctl enable uwsgi... 2024. 12. 26. 구글 네이버 sso 로그인 django 설정 정보 settings.pyINSTALLED_APPS = [ # sso 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.google', 'allauth.socialaccount.providers.naver',] MIDDLEWARE = [ 'allauth.account.middleware.AccountMiddleware', # sso 미들웨어 추가] AUTHENTICATION_BACKENDS = [ # sso 'allauth.account.auth_backends.AuthenticationBackend',]# ssoACCOUNT_ADAPTER = 'acco.. 2024. 11. 20. 기본 django 세팅 settings.py# Static files (CSS, JavaScript, Images)STATIC_URL = '/static/'# Optional: 추가적인 정적 파일 경로를 지정하고 싶을 때STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'common_static'), # 프로젝트 루트에 있는 공통 정적 파일 디렉토리]# collectstatic 명령어로 모아질 파일들이 저장될 위치STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') 기본 애플리케이션 urls.pyurlpatterns = [ path('', include('앱이름.urls')),] 추가 애플리케이션 urlpatterns = [ path('앱이름.. 2024. 8. 27. uWSGI 관련 uWSGI는 장고와 웹서버를 연결해주는 웹서버인터페이스이다. uwsgi --stop /tmp/django.pid-> uwsgi 중단uwsgi --ini /etc/uwsgi/sites/djangoProject.ini --py-autoreload 1-> django 변경사항이 있다면 자동으로 재시작 tail -f /tmp/uwsgi.log -> 실시간 로그 확인 2024. 8. 23. 이전 1 2 다음