yuto0o commited on
Commit
edf4acf
·
1 Parent(s): 1c747b5

開発環境との調整

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. README_2.md +20 -1
  3. config/settings.py +5 -2
.gitignore CHANGED
@@ -10,3 +10,4 @@ wheels/
10
  .venv
11
 
12
  db.sqlite3
 
 
10
  .venv
11
 
12
  db.sqlite3
13
+ .env
README_2.md CHANGED
@@ -2,6 +2,23 @@
2
 
3
  ```
4
  uv sync
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ```
6
 
7
  ## requirement.txt 更新するときは
@@ -12,7 +29,7 @@ uv pip compile pyproject.toml -o requirements.txt
12
 
13
  を使うこと
14
 
15
- ## build 実行
16
 
17
  ```
18
  docker build -t my-django-bot .
@@ -57,4 +74,6 @@ cat ~/.cache/huggingface/token
57
  # なんかpushできないとき
58
  git push https://yuto0o:YOUR_HF_TOKEN@huggingface.co/spaces/yuto0o/django-ai-chat main
59
 
 
 
60
  ```
 
2
 
3
  ```
4
  uv sync
5
+ uv run python manage.py migrate
6
+ uv run python manage.py runserver
7
+ # local host 8000にアクセスしよう
8
+ # {"text": "こんにちは?"} でpostすればできる
9
+ ```
10
+
11
+ config/settings.py の DEBUG は True にしておくと色々見えやすい
12
+
13
+ ```
14
+ DEBUG =True
15
+ ```
16
+
17
+ .env をつくって"dev-key"を入れておくとよい
18
+
19
+ ```
20
+ # SECURITY WARNING: keep the secret key used in production secret!
21
+ SECRET_KEY = os.environ.get("SECRET_KEY", "dev-key")
22
  ```
23
 
24
  ## requirement.txt 更新するときは
 
29
 
30
  を使うこと
31
 
32
+ ## build 実行(docker)
33
 
34
  ```
35
  docker build -t my-django-bot .
 
74
  # なんかpushできないとき
75
  git push https://yuto0o:YOUR_HF_TOKEN@huggingface.co/spaces/yuto0o/django-ai-chat main
76
 
77
+ # SECRET_KEY = os.environ.get("SECRET_KEY", "dev-key")の"SECRET_KEY"をリポジトリで登録しておくとよい
78
+
79
  ```
config/settings.py CHANGED
@@ -10,6 +10,7 @@ For the full list of settings and their values, see
10
  https://docs.djangoproject.com/en/6.0/ref/settings/
11
  """
12
 
 
13
  from pathlib import Path
14
 
15
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -20,10 +21,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
20
  # See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
21
 
22
  # SECURITY WARNING: keep the secret key used in production secret!
23
- SECRET_KEY = "django-insecure-t1!a(5z1#&355c2nl%w$nbiavye67l9f(4t$64uxg4g45y-xtl"
 
24
 
25
  # SECURITY WARNING: don't run with debug turned on in production!
26
- DEBUG = True
 
27
 
28
  ALLOWED_HOSTS = ["huggingface.co", ".hf.space", "localhost", "127.0.0.1"]
29
 
 
10
  https://docs.djangoproject.com/en/6.0/ref/settings/
11
  """
12
 
13
+ import os
14
  from pathlib import Path
15
 
16
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
 
21
  # See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
22
 
23
  # SECURITY WARNING: keep the secret key used in production secret!
24
+ SECRET_KEY = os.environ.get("SECRET_KEY", "dev-key")
25
+
26
 
27
  # SECURITY WARNING: don't run with debug turned on in production!
28
+ DEBUG = False
29
+ # True
30
 
31
  ALLOWED_HOSTS = ["huggingface.co", ".hf.space", "localhost", "127.0.0.1"]
32