2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Djangoで作成したプロジェクトをGitHubに公開する前の諸々

Last updated at Posted at 2024-03-22

備忘録として

wsl Ubuntu-22.04使用


pip install python-dotenv

setting.py
#Pathの下に
from dotenv import load_dotenv
import os
load_dotenv()


.envファイル作成



settings.pyの"SECRET_KEY"をコピー

.envに貼り付け

.env
SECRET_KEY = #貼り付け#
DEBUG=false(デプロイ時)
DATABASE_URL=sqlite:///db.sqlite3
# '' は不要

settings.py
SECRET_KEY = os.environ.get('SECRET_KEY')

pip freeze > requirements.txt


.gitignoreファイル作成
( 参考:https://qiita.com/anqooqie/items/110957797b3d5280c44f
https://www.toptal.com/developers/gitignore
←こんなのあるんだ

.gitignore
#example
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
instance/
.webassets-cache
.scrapy
docs/_build/
target/
.ipynb_checkpoints
venv/
ENV/
.spyderproject
.spyproject
.idea/
*.iml
.vscode/
node_modules/
.env
.DS_Store
Thumbs.db


よしなに


参考動画
https://www.youtube.com/watch?v=7tRLkZO6D3Y
https://www.youtube.com/watch?v=fVy9eJzloj8

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?