meong_j
기록하는 습관.
meong_j
전체 방문자
오늘
어제
  • 분류 전체보기 (176)
    • 개인 공부 정리 (0)
    • 서버 운영 (37)
      • Linux (36)
    • Frontend (11)
      • Vue.js (10)
    • Backend (70)
      • Java (4)
      • Python (22)
      • Django (38)
      • Spring (6)
    • Database (5)
      • Oracle (4)
      • MySQL (1)
      • MariaDB (0)
    • Android (14)
      • Kotlin (6)
    • 배포 (9)
      • Docker (8)
      • AWS (1)
    • IT_study (29)
      • Coding test (17)
      • 알고리즘 (5)
      • 스터디 (6)

블로그 메뉴

  • 홈
  • 태그
  • 방명록
  • github

인기 글

반응형

태그

  • dp #알고리즘
  • 개발자도서
  • 중첩라우트
  • 안드로이드adaptor
  • 리눅스인증
  • Proxy
  • dockersecret
  • 배포인프라
  • DHCP
  • cpu사용률
  • 리눅스방화벽
  • 이차원배열정렬
  • 코틀린자료형
  • router-link
  • SASS Variables
  • Kotlin
  • 테크커리어
  • django
  • docker
  • gabagecollecter

최근 댓글

최근 글

250x250
hELLO · Designed By 정상우.
meong_j

기록하는 습관.

django 02. Git 활성화, 환경변수 분리, commit
Backend/Django

django 02. Git 활성화, 환경변수 분리, commit

2021. 10. 5. 18:22
728x90
반응형

 

.gitignore 파일 생성

https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore

 

GitHub - github/gitignore: A collection of useful .gitignore templates

A collection of useful .gitignore templates. Contribute to github/gitignore development by creating an account on GitHub.

github.com

 

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# venv 폴더에 있는 것 추적안하게 설정
venv/
# env파일 추적안되게 설정
.env

db.sqlite3

.idea/

__pycache__/
  • 프로젝트 내 .gitignore 파일 생성
  • 복사하여 .gitignore 파일에 붙여넣기
  • git 활성화될 수 있게 설정
  • __pycache__지우고 git commit해야함

 

 

장고에서 환경 설정하는 environ 설치

https://django-environ.readthedocs.io/en/latest/

 

django-environ

Next Getting Started

django-environ.readthedocs.io

  • 터미널 창에 명령어 입력 후 django-environ 설치
  • pip install django-environ

 

 

settings.py 설정 추가

from pathlib import Path

import environ
import os

from django.conf.global_settings import LOGIN_REDIRECT_URL
from django.urls import reverse_lazy

env = environ.Env(
    # set casting, default value
    DEBUG=(bool, False)
)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Take environment variables from .env file
environ.Env.read_env(
    env_file=(os.path.join(BASE_DIR, '.env'))
)


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
# .env 파일에서 SECRET_KEY 읽어옴(git 업로드방지)
SECRET_KEY = env('SECRET_KEY')

 

.env 파일 생성 및 작성

DEBUG=on
SECRET_KEY=django-insecure-5s!yla+)4^w!%k@kbo=*str)v$nm$9xb7*u+re=qbb2ikw3=lm
DATABASE_URL=psql://user:un-githubbedpassword@127.0.0.1:8458/database
SQLITE_URL=sqlite:///my-local-sqlite.db
CACHE_URL=memcache://127.0.0.1:11211,127.0.0.1:11212,127.0.0.1:11213
REDIS_URL=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=ungithubbed-secret
  • SECRET_KEY는 settings.py에서 가져온 것
  • 배포시 배포 항목에 포함되지 않는 항목만 모아서 안되게 설정함

 

VSC - git 활성화

git status

  • git 공유되었는지 확인
  • 빨간색 표시- 공유되지 않음 표시

 

 git add .

  • git 공유 시작

 

 git commit -m "commit할 메시지"

  • commit 메시지 작성 및 commit 하기
반응형

'Backend > Django' 카테고리의 다른 글

django 04. include/ extends / block 구문을 이용한 뼈대 html 만들기  (0) 2021.10.05
django 03. 장고 template의 extends, include 구문과 render 함수  (0) 2021.10.05
django 01. 첫 앱 시작, 그리고 기본적인 view 만들기  (0) 2021.10.05
[Django] Settings.py 파일 공통, 개발, 운영 파일로 나누어 환경 설정 분리하기  (0) 2021.10.04
[Django] 장고 settings.py 설정 및 구조 알아보기  (0) 2021.09.30
    'Backend/Django' 카테고리의 다른 글
    • django 04. include/ extends / block 구문을 이용한 뼈대 html 만들기
    • django 03. 장고 template의 extends, include 구문과 render 함수
    • django 01. 첫 앱 시작, 그리고 기본적인 view 만들기
    • [Django] Settings.py 파일 공통, 개발, 운영 파일로 나누어 환경 설정 분리하기
    meong_j
    meong_j
    #it #개발일기 #개발공부 #개발자 #백앤드 #생각정리 #시간은 실력에 비례한다 #뭐든지 꾸준히 열심히 #오늘의 내가 내일의 나를 만든다

    티스토리툴바